## 3 Methodology
### YOLO Algorithm  
The YOLO series represents one of the most prevalent real-time object detection algorithms in modern times, including iterations such as YOLOv5, YOLOv7 [35], and YOLOv8, among others. YOLOv5 utilizes the cross stage partial (CSP) [36] network architecture, which significantly reduces computational expense, thereby offering enhanced real-time performance as well as the characteristic of a lightweight model. However, YOLOv5 encounters certain challenges and limitations within scenarios involving the identification of targets with high density and tiny size. In response to these shortcomings, YOLOv7 innovatively introduces a trainable bag of freebies strategy, which significantly enhances the model's detection accuracy and generalization capability. Nevertheless, due to limitations related to training datasets, model architecture, and hyperparameters, YOLOv7 might undergo a decrease in performance under certain unique conditions. Recently, Ultralytics, the developer of YOLOv5, released the YOLOv8 algorithm in 2023. Figure 1 depicts the network architecture. The architecture of the algorithm primarily comprises three components: backbone, neck, and a detection head. This network topology will be explained in depth in the material that follows.  
In the design of the backbone network, to achieve effective feature extraction, the hierarchical path aggregation concept of CSP is adopted, and the construction principles of the E-Net Like Attention Network (ELAN) are incorporated, which showcased advanced performance in YOLOv7. By swapping out the YOLOv5's C3 module for the more sophisticated C2f module, the structure not only maintains a lightweight profile but also enhances feature fusion capabilities, permitting a gradient flow of information via the network that is more plentiful. The SPPF module, which comes in after the backbone network, keeps improving the model's capacity to identify objects at different sizes. This module employs three \(5\times 5\) maxpool operations before each fusion layer to ensure detection accuracy for multi-scale targets while maintaining the network's lightweight characteristics.  
The integration of features from several scales is the neck network's main purpose. By adopting a Path Aggregation Network-Feature Pyramid Network (PAN-FPN) architecture [37; 38], both top-down and bottom-up streams of feature flow are constructed, facilitating the efficient integration of shallow spital information and rich semantic information. This structure allows the network to gain a broader and more enriched feature representation, thereby enhancing the model's capability for object detection.  
YOLOv8 integrates YOLOv8 approach of using decoupled heads within its detection mechanism, opting for distinct pathways for classifying objects and for bounding box adjustments, employing unique loss functions for each [39]. Specifically, it utilizesbinary cross-entropy (BCE) loss for object classification and combines distribution focal loss (DFL) [40] with complete intersection over union (CIoU) [41] loss for more accurate bounding box regression. This architecture not only boosts the accuracy of the model but also speeds up the convergence during training. Moreover, YOLOv8 adopts an anchor-free design, directly identifying object centers, which simplifies the process of non-maximum suppression. In the loss calculation process, the TaskAlignedAssigner method is used to determine positive and negative sample assignments. Regression and classification scores are combined and weighted to determine positive sample selection, thereby improving the model's detection accuracy and robustness [42].