# Multiscale YOLOv5-AFAM-Based Infrared Dim-Small-Target Detection
## 3 Experiments
### Experiments and Analysis
#### 3.3.4 Visualization and Analysis  
To further analyze the improvement of our multiscale YOLOv5-AFAM compared to the YOLOv5 model, we conduct a series of visualization experiments. We visualize the curves of losses, precisions, recalls, [EMAIL_ADDRESS], and [EMAIL_ADDRESS]:0.95 of the two models in the training stage, as shown in Figure 10.  
\begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline
**AFAM** & **DownC** & **4s** & **4 ds** & **3 ss** & **Params** & **GFLOPs** & **[EMAIL_ADDRESS]** & **[EMAIL_ADDRESS]:0.95** & **P** & **R** \\ \hline ✗ & ✗ & ✗ & ✗ & ✗ & 14.1 M & 15.8 & 0.814 & 0.376 & 0.795 & 0.821 \\ \hline ✓ & ✗ & ✗ & ✗ & �  
During training, the multiscale YOLOV5-AFAM model has several following performance improvements compared to the YOLOv5s model. As shown in Figure 10a, the training loss had a significantly faster convergence speed, and it reached a lower value at the end of the training. Overall, the stability of each indicator during training had increased and jitter had decreased. As can be seen in Figure 10b,c, there are improvements in precision and recall during training, which means the multiscale YOLOV5-AFAM had a higher [EMAIL_ADDRESS]. From Figure 10d,e, we can conclude that the [EMAIL_ADDRESS] and [EMAIL_ADDRESS]:0.95 of the multiscale YOLOV5-AFAM had improved, especially [EMAIL_ADDRESS]:0.95, which rose by 1.8%, indicating that our algorithm was more accurate in the infrared dim and small vehicle recognition and localization. We compare the multiscale YOLOv5s-AFAM model and the YOLOv5s model on the validation set, with a confidence threshold of 0.25 and NMS IoU threshold of 0.45. Figure 11 shows four cases that can prove the superiority of our model. Figure 10: The changes in each indicator of the YOLOv5 model and the multiscale YOLOv5-AFAM model during the training process: (**a**) box loss; (**b**) precision; (**c**) recall; (**d**) [EMAIL_ADDRESS]; (**e**) [EMAIL_ADDRESS]:0.95. We can see that the improved model performs significantly better with a higher confidence score. In addition, there are fewer cases of missing or false positives in the detection results, and the improved model has a better performance in dense and occluded scenes. A heat map is a visualization tool that can demonstrate target detection results and visualize the target activation score as a color image to observe the correctness and accuracy of the target detection results. Figure 12 shows heat maps derived from an input image. The heat map can show information such as the density, distribution, or intensity of the data by the shade of color. In addition, the heat map is used to visualize the activation level of the prediction corresponding to each position of the network on the image. Specifically, the image is divided into a number of small cells. Each grid corresponds to a confidence score, and these scores are then represented as shades of color, with darker colors indicating a higher confidence level for the region on the image. The heat map provides a more visual indication of how well the algorithm detects different regions of the image and the confidence distribution of the results. While in traditional detection networks, feature maps are usually treated with equal weights, the AFAM attention mechanism introduced by the improved algorithm proposes a dynamic weight assignment method that allows the network to focus adaptively on features in different regions. Through AFAM attention, the network is able to capture the features associated with the target more accurately. Figure 11: Four cases of comparison between two models: (**a**) false negative; (**b**) false positive in category; (**c**) false positive from the background; (**d**) under the dense and occluded scene. The original image and its heat map detected by the improved algorithm are shown in Figure 12.  
Figure 12b-g show the three stages of feature extraction by the network from light to dark.