## 2 YOLOv5 Algorithm  
Input, Backbone, Neck, and Prediction are the four primary components of YOLOv5, and Figure 1's network topology depicts these components. YOLOv5 has four different network models: YOLOv5s, YOLOv5m, YOLOv5l, and YOLOv5x. In this paper, YOLOv5s is chosen as the base architecture [24]. YOLOv5 uses bi-trivial interpolation on the input side to fix the image size, uses Mosaic data enhancement, and solves the black edge problem by adaptive scaling. Backbone uses CSPDarknet53 as a feature extraction network, adding a CSP module to enable some features to be connected across stages and extracting the initial image features by spatial pyramid pooling (SPP), reducing the computational effort. Neck creates feature pyramids with various scales and resolutions using the PANet network structure, which consists of a set of top-down and bottom-up paths. PAN creates feature pyramids at various scales by using the feature maps from the Backbone bottom-up and several convolutional layers. FPN adopts top-down feature pyramids and upsamples them to higher resolutions, thus allowing for finer-grained target detection. The multi-scale problem is resolved by using both at the same time, improving the network feature fusion capabilities and the model's identification of targets of various sizes. The detection head in Prediction is made up of a number of convolutional layers that use three anchor frames for each scale of prediction to determine the location of objects in the image before obtaining the greatest confidence frame by non-maximum suppression [25]. Compared with YOLOv3, YOLOv5 uses Mosaic data augmentation, adaptive anchor frame calculation, adaptive image scaling operations on the Input side and introduces the Focus module and CSP module on the backbone, which makes the model modular and increases the flexibility of the model. In addition, unlike the Darknet framework used in YOLOv4, the Pytorch framework used in YOLOv5 makes it easier for others to train their own datasets on YOLOv5. YOLO  
Figure 1: YOLOv5s network structure. in terms of network structure. YOLOX also uses the Focus module and CSPDarknet on backbone53, and uses FPN + PAN structure like YOLOv4 and YOLOv5. Focus downsampling is the main feature that distinguishes YOLOv5 from YOLOv4, mainly by slicing the higher-resolution image into multiple lower-resolution feature maps [26]. Focus expands the input channels by a factor of 4, which can increase the computational power of the network while preventing information loss, and then slices the image. As shown in Figure 2, the 4 \(\times\) 4 \(\times\) 3 image is firstly sliced into four parts, and then stitched into a 2 \(\times\) 2 \(\times\) 12 feature map in channel dimension, and then convolved by 3 \(\times\) 3 to obtain different feature information and output channel 32 to generate a 2 \(\times\) 2 \(\times\) 32 feature map [27]. The feature map consists of a convolutional layer, a BN (Batch Normalization) layer, and an activation function layer; CBS is similar to CSP in that it is a composite convolutional module. Among them, the convolution layer is ordinary convolution, and the BN layer introduces normalized activation into the network and normalizes it, which ensures that the input distribution inside the model can be learned by each layer when the model is trained and facilitates fast convergence of the accelerated network. The SiLU function is utilized in YOLOv5s as the activation function, enhancing the model's performance and allowing for more nonlinear expression. The SiLU function has the following expression:  
\[SiLU(x)=\frac{x}{1+e^{-x}} \tag{1}\]  
The CSP structure is enhanced by YOLOv5 by using C3. It has two channels, one of which uses multiple Bottleneck stacks and three common convolutional layers. The other goes through a convolutional module, and the two channels are then concatenated (concat) and output by Conv. In contrast to the BottleneckCSP module, the SiLU function replaces the activation function in the convolution module after concat.