## 2 Methods and Data  
### YOLOv8 Network Models  
YOLOv8 is a deep neural network based on a one-stage object detection algorithm proposed by Ultralytics. It is partially improved on the previous successful YOLO version, and its performance has shown significant advantages in accuracy, ease of use, hardware support, and versatility. It is the first choice for many tasks, such as attitude estimation, instance segmentation, multi-target tracking, and feature extraction. YOLOv8 provides a new state-of-the-art (SOTA) model, which includes P6 640 and P6 1280 resolution target detection network and Yolact-based instance segmentation models, and provides different \(n\), \(s\), \(m\), \(l\), and \(x\) scale models according to different scaling coefficients, to meet the needs of different scenarios. YOLOv8 is mainly composed of three parts: a backbone network, neck network, and task head, as shown in Figure 1. The backbone network of YOLOv8 still adopts the idea of a Cross Stage Partial Network (CSP), but the C3 module used in YOLOv5 is replaced by the C2f module. The C2f module is based on the C3 module. In addition to ensuring a lightweight design, the model can obtain more abundant gradient flow information. This improvement helps the model to transfer the gradient more effectively during the training process, and reduces the calculation and the number of parameters, thus speeding up the training process and improving the performance of the model. The Path AggregationNetwork (PANet) is used to fuse the feature maps of different layers from top to bottom, which makes feature fusion more efficient. The decoupling head structure is used to separate the detection and classification tasks and accelerate the convergence of the model. YOLOv8 uses Binary Cross-Entropy (BCE) as a classification loss function:  
\[\text{L}_{\text{total}}=-\frac{1}{\text{N}}\text{$\sum_{i=1}^{n}[y_{\text{i}} \cdot\log(\text{p}_{\text{i}})+(1-\text{y}_{\text{i}})\cdot\log(1-\text{p}_{ \text{i}})]$} \tag{1}\]  
where \(\text{L}_{\text{total}}\) represents the total loss, N represents the total number of samples, n represents the number of samples used to calculate the loss, y\({}_{\text{i}}\) represents the actual label of the ith sample, and p\({}_{\text{i}}\) represents the probability that the ith sample is predicted to be class 1. The BCE is a loss function commonly used in machine learning to deal with binary classification problems, such as whether there is an animal in the photo, or whether the animal in the picture is a cat or a dog. In YOLOv8, this function is used to evaluate the difference between the probability of target existence predicted by the model and the real label, thereby helping to optimize the model parameters and improve target detection accuracy. In a binary classification problem, y\({}_{\text{i}}\) is usually either 0 or 1, where 0 represents a negative class (or \"not\" the target class) and 1 represents a positive class (or \"yes\" the target class). \(\log(\text{p}_{\text{i}})\) and \(\log(1-\text{p}_{\text{i}})\) are the logarithms of the probabilities predicted by the model. p\({}_{\text{i}}\) is the probability (usually between 0 and 1) that the model predicts that the ith sample will be positive. \(1-\text{p}_{\text{i}}\) is the probability that the model predicts that the sample is of a negative class. By taking the logarithm of these probabilities, we can measure the uncertainty of the model's predictions. Compared to previous versions, YOLOv8 uses a deeper and more complex network structure and improved training techniques to significantly improve detection accuracy while maintaining high speeds. It uses a more advanced feature extraction network, which helps to extract richer and more distinguished features from images. At the same time, the improved multi-scale prediction technology is introduced, which can better detect objects of different sizes, and the adaptive adjustment of the anchor frame is also optimized, which can predict the position and size of the object more accurately.