## 4 Experiment and Analysis
### Visualization  
In this study, we conducted an in-depth analysis of the improved RT DETR model's performance in student classroom behavior detection through heatmap visualization experiments. Heatmaps were generated by the attention weights predicted by the model, visually representing the model's focus on certain areas of the image, as shown in Figure 8. This visualization provides intuitive evidence for understanding and interpreting the model's decision-making process.  
\begin{table}
\begin{tabular}{l c c c c c c} \hline \hline
**Model** & **Params** & **GFLOPs** & **FPS** & **mAP50** & **mAP50-95** \\ \hline RT DETR-ResNet18 & 19,878,180 & 57.0 & 65.9 & 0.871 & 0.602 \\ RT DETR-Faster & 16,790,180 & 49.5 & 69.6 & 0.879 & 0.615 \\ RT DETR-EfficientViT & 10,707,748 & 27.2 & 70.9 & 0.836 & 0.577 \\
**RT DETR-MobileNetv3** & **9,546,660** & **23.6** & **76.4** & **0.857** & **0.591** \\ \hline \hline \end{tabular}
\end{table}
Table 2: The impact of different backbone networks on model performance.  
\begin{table}
\begin{tabular}{l c c c c c c c c} \hline \hline
**Model** & **Focus** & **Writing** & **Raising Hand** & **Sleeping** & **Using Phone** & **All Classes** & **Params** & **GFLOPs** & **FPS** \\ \hline RT DETR-ResNet18 & 0.852 & 0.823 & 0.923 & 0.886 & 0.874 & 0.872 & 19,878,180 & 57.0 & 65.9 \\ \hline RT DETR-ResNet18+LPE & 0.850 & 0.847 & 0.917 & 0.918 & 0.859 & 0.878 & 19,980,580 & 57.0 & 60.2 \\ \hline RT DETR-ResNet18+DySample & 0.866 & 0.848 & 0.937 & 0.902 & 0.847 & 0.880 & 19,894,628 & 57.0 & 58.8 \\ \hline RT DETR-ResNet18+LPE+DySample & 0.875 & 0.857 & 0.941 & 0.917 & 0.833 & 0.885 & 19,997,028 & 57.0 & 57.6 \\ \hline
**RT DETR-MobileNetv3+LPE+DySample** & **0.850** & **0.829** & **0.917** & **0.929** & **0.814** & **0.868** & **9,665,508** & **26.3** & **72.3** \\ \hline \hline \end{tabular}
\end{table}
Table 3: Comparative analysis of the impact of different module enhancements on the RT DETR algorithm performance.  
In the experiment, we first captured a series of representative classroom scenes involving various typical student behaviors, such as raising hands, sleeping, distraction, writing, and using mobile phones. These scenes were then processed using YOLOv8, the original RT DETR, and our improved RT DETR model to generate the corresponding heatmaps. The improved heatmaps demonstrated the superior performance of the optimized model in the following aspects:  
1. Enhanced attention focus: The improved model exhibited more concentrated attention distribution on the heatmaps. This indicated that the model effectively focused on areas closely related to the behavior detection task, reducing attention dispersion to irrelevant regions.
2. Optimized spatial resolution: Through improved positional encoding, the model displayed finer spatial resolution on the heatmaps. This was reflected in clearer boundaries of active regions, enhancing behavior detection accuracy.
3. Improved feature layer fusion: The improved CCFM upsampling strategy demonstrated better multi-scale fusion effects on the heatmaps. This ensured a smoother transition from low-level to high-level features, aiding in capturing detailed information while maintaining overall behavior pattern recognition.
4. Reduced noise and interference: The improved model produced clearer signals on the heatmaps, effectively suppressing noise and background interference. This is particularly important as it indicates the model's enhanced robustness to various types of interference in real classroom environments.