## 2 Related Work  
_YOLOv5_  
Among the series of object detection models, the most classic one-stage detection model is the YOLO series, of which YOLOv5 [33] was released by Ultralytics in 2020. After continuous updates and upgrades, there are five versions of the YOLOv5 algorithm in the order of increasing the weight, width, and depth of the model, which are YOLOv5n, YOLOv5s, YOLOv5m, YOLOv5m YOLOv5l, and YOLOv5x. The overall structure of the YOLOv5 network is shown in Figure 1, which consists of four main parts: input side, backbone, neck, and head. Data augmentation, self-adaptive anchor frame calculation, and self-adaptive image scaling are implemented on the input side. The data augmentation process, in which Mosaic data augmentation cite18 is used in addition to the basic data augmentation method, as shown in Figure 2, randomly takes four images from the dataset and rotates, flips, scales,  
Figure 1: The overall structure of the YOLOv5 network. and splices them to obtain new training data, adding small target samples to enrich the dataset and further enhance the training speed of the network. In the self-adaptive anchor frame calculation process, the set anchor frame is input to the network to calculate the predicted frame compared with the real frame to reverse update the network parameters and iterate to reach the best. In the self-adaptive image scaling process, calculating the scaling ratio, size, and black border fill values to add the least amount of black border and retain the most features. Backbone consists of a 6 x 6 Conv module equivalent to Focus, four Conv modules, four C3 modules, and the SPPF module. The input image is firstly sliced through the 6 x 6 Conv module by taking a value for every pixel interval in the horizontal and vertical directions, halving the image size and quadrupling the number of channels, followed by a series of convolution, pooling, Cross Stage Partial Network (CSPNet), and finally extracting high-level semantic information through SPPF to obtain the feature map. Neck follows the structure of Feature Pyramid Networks (FPN) combined with the Path Aggregation Network (PAN) [34], which achieves the fusion of high-level semantic information with shallow location information to improve the model detection accuracy while preserving the original image information. Head obtains high-quality candidate frames by using the non-maximum suppression method to remove low-quality predicted frames from the target anchor frames of corresponding sizes detected from the Neck of three different sizes of feature maps. The loss of a target detection class model generally consists of target confidence loss, classification loss, and bounding box loss, which is shown as Equation (1), where \(\lambda_{1},\lambda_{2},\lambda_{3}\) are the equilibrium coefficients. \[\text{Loss }=\lambda_{1}L_{cla}+\lambda_{2}L_{loc}+\lambda_{3}L_{conf} \tag{1}\]  
The target confidence of YOLOv5 and the loss of classification are adopted from BCEWithLogitsLoss, as shown in Equations (2) and (3). \[BCEL=-\sum_{i=1}^{N}[y_{i}^{*}\ln(\sigma(x_{i}))+(1-y_{i}^{*})\ln(1-\sigma(x_{ i}))] \tag{2}\]  
\[\sigma(x_{i})=\text{Sigmoid}(x_{i})=\frac{1}{1+e^{-x_{i}}} \tag{3}\]  
where \(N\) represents the number of target categories, \(x_{i}\) represents the predicted value of the \(i\) category, \(\sigma(x_{i})\) represents the probability of the \(i\) category after the sigmoid function, and \(y_{i}^{*}\) represents the true value of the \(i\) category. Bounding box loss is calculated using CIoU Loss [35], as shown in Equations (4)-(6). Where \(\alpha\) is the weight coefficient, \(v\) is used to measure the consistency of the relative proportions of two rectangular boxes, \(w8^{st},hs^{st}\) represents the width and height of the real  
Figure 2: Mosaic data augmentation process. box, \(w,h\) represents the width and height of the predicted box, and \(IoU\) represents the intersection ratio of the predicted box and the real box.