## 2 Materials and Methodology
### Indicators for Model Evaluation  
To evaluate the performance of the model at different IOU thresholds, we utilize several metrics, including precision, recall, and mAP, at different IOU thresholds, such as 0.5, 0.75, and across the range of 0.5 to 0.95, as well as calculate the F1-score. These metrics provide insights into the accuracy, completeness, and overall performance of the model in detecting and localizing objects. Simultaneously, we also consider the number of parameters and the amount of computation (FLOPs) of the model as auxiliary indices to evaluate model complexity when comparing it with other mainstream models. Precision is computed by dividing the number of accurately recognized livestock instances by the total number of livestock instances detected by the model. It represents the ratio of correctly identified instances out of all the instances predicted as livestock. Recall, on the other hand, is determined by dividing the total number of correctly tagged livestock instances in the dataset by the ratio of properly recognized livestock examples. It represents the proportion of correctly identified instances out of all the actual livestock instances present in the dataset. They are calculated as follows:  
\[\text{Precision}=\frac{\text{TP}}{\text{TP}+\text{FP}} \tag{5}\]  
\[\text{Recall}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{6}\]  
The number of livestock cases the YOLOv8 network model successfully identified is shown by the acronym TP. The number of livestock cases that the model misidentified as livestock is shown by the acronym FP. The number of livestock cases that the model overlooked or could not identify is shown by the acronym FN. The area under the PR curve represents AP, which is the average precision for various recall settings. The average accuracy for a class is represented by the symbol [EMAIL_ADDRESS] when the IOU threshold for confusion matrices is set to 0.5. To clarify, a predicted bounding box is only regarded as a true positive and included in the precision computation if it surpasses an IoU of 0.5 with the matching ground truth bounding box. [EMAIL_ADDRESS] is calculated similarly, yet with a more stringent IoU threshold of 0.75. This imposes greater demands on detection accuracy, requiring that predicted bounding boxes achieve an IoU of no less than 0.75 with the ground truth to be acknowledged as correct detections and to be counted towards the true positive tally. Elevating the IoU threshold from 0.5 to 0.75 introduces a stricter criterion for classifying a detection as accurate, thus offering a more refined estimate of the model's detection efficacy. An extensive analysis of the trade-off between overall detection precision and localization accuracy is provided via assessments across several IoU levels. The different AP values are calculated as follows:  
\[\[EMAIL_ADDRESS]}=\int_{0}^{1}Precision(Recall)\text{d}(Recall),\text{ where IoU}\geq 0.5 \tag{7}\]  
\[\[EMAIL_ADDRESS]}=\int_{0}^{1}Precision(Recall)\text{d}(Recall),\text{ where IoU}\geq 0.75 \tag{8}\] \begin{table}
\begin{tabular}{c c c c} \hline
**Parameter** & **Setting** & **Parameter** & **Setting** \\ \hline optimizer & SGD & epochs & 300 \\ momentum & 0.937 & batch & 16 \\ seed & 0 & workers & 8 \\ imgsz & 640 & close\_mosaic & 10 \\ lr0 & 0.01 & lr1 & 0.01 \\ \hline \end{tabular}
\end{table} 
Table 1: Training parameters settings. The mAP is the mean of the AP values for all categories. Greater mAP values signify a model's elevated average detection precision across all target categories. The mAP values are calculated as follows:  
\[\text{mAP}=\frac{1}{Q}\sum_{q=1}^{Q}\text{AP}(q) \tag{9}\]  
\[\[EMAIL_ADDRESS]:0.95}=\frac{1}{10}\sum_{t=0.5}^{0.95}\text{mAP@t} \tag{10}\]  
An important metric for evaluating the efficacy of a binary classification model is the F1-score. It is an average of precision and recall that is harmonized and takes both into account. The range of values for the F1-score is 0 to 1. It is calculated as follows:  
\[F1=\frac{2\times Precision\times Recall}{Precision+Recall} \tag{11}\]