## 2 YOLO Algorithm and Its Improvements
### Improvements to the Backbone Section  
To precisely implement multi-scale target detection, this study introduces the AFAM [29]. AFAM comprises two sub-modules: the Adaptive Channel Module (ACM) and the Fusion Spatial Module (FSM). When integrated into the backbone network of YOLOv5, the AFAM module is embedded within the C3 module. As illustrated in Figure 3, the process begins with the feature mapping \(F\ e\ \mathbb{R}^{C\times H\times W}\). As inputs to the network, these feature maps are subsequently passed through the ACM and FSM, sequentially integrating attention information in both channel and spatial dimensions. The mathematical expression is shown in Equation (1); \(F_{A}\) represents the features \(F\) obtained after processing through the ACM, and \(F^{\prime}\) represents the features \(F_{A}\) obtained after processing through the FSM. This demonstrates that this structural design not only enhances the model's ability to handle multi-scale features but also improves the accuracy of detecting small objects, thereby effectively boosting the overall performance of object detection. \[F_{A}=f_{A}(F)\otimes F,\quad F^{\prime}=f_{F}(F_{A})\otimes F_{A} \tag{1}\]  
In this context, \(f_{A}(\cdot)\) represents the ACM and \(f_{F}(\cdot)\) represents the FSM. \(\otimes\) denotes an element-wise multiplication operation. Figure 2: Enhanced YOLOv5 model architecture diagram. This diagram highlights the modifications made to the original YOLOv5 architecture shown in Figure 1. In the backbone, the standard downsampling convolution modules are replaced with DownC modules (DownC(1/4), DownC(1/8), DownC(1/16), and DownC(1/32)), and C3 modules are replaced with C3 AFAM modules to enhance feature extraction with attention mechanisms. In the neck, EMA modules are added after each C3 module to further improve multi-scale feature integration. Additionally, an extra detection layer (Detect(1/4)) is included in the head to enhance the detection of small objects. The ACM, illustrated in Figure 4, initiates with parallel convolutions using kernels of three distinct sizes (1 \(\times\) 1, 3 \(\times\) 3, and 5 \(\times\) 5) to capture multi-scale feature information. These convolutional outputs are subsequently integrated and processed via a weighted summation method to generate fused features (denoted as \(F_{f}\)). The mathematical details of this process are provided in Equation (2). Following this, the fused features undergo average pooling (Avgpool) and max pooling (Maxpool) operations to produce descriptors that characterize the targets. Finally, these descriptors are further analyzed by a multi-layer perceptron (MLP) to yield the ultimate adaptive receptive field and channel attention features. This process is depicted in Equation (3). \[F_{f}=\sum_{i=1}^{3}(Conv_{i}(F)\times\omega_{i}) \tag{2}\]  
\[F_{A}=\sigma(MLP(Avgpool(F_{f}))+MLP(MaxPool(F_{f}))) \tag{3}\]  
In Equation (2), \(Conv(\cdot)\) signifies the convolution operation using three different kernel sizes, and \(\omega_{i}\) represents the ith weight factor for each convolution operation. In Equation (3), \(\sigma(. )\) denotes the _sigmoid_ function. \(AvgPool\) and \(MaxPool\) refer to the average pooling and max pooling operations, respectively. The FSM, as illustrated in Figure 5, inputs the feature maps generated by ACM (denoted as \(F_{A}\)) into three distinct branches in parallel, aiming to extract multi-dimensional feature information, as shown in Equation (4). \[F_{A}^{max}=f_{max}(MaxPool(F_{A})),\quad F_{A}^{avg}=AvgPool(F_{A}),\quad F_{ A}^{conv}=f_{3\times 3}(F_{A}) \tag{4}\]  
In Equation (4), \(f_{max}(\cdot)\) represents the convolution operation with a kernel size of \(h\times\omega\). Subsequently, the output features from these three branches are merged and further refined through a convolutional module (denoted as \(f_{C}(\cdot)\)). Afterwards, the merged feature  
Figure 4: ACM network architecture diagram.