# Detection of Threats to Farm Animals Using Deep Learning Models: A Comparative Study
## 4 Results  
Experimental studies were conducted using deep learning-based YOLOv8, Yolo-NAS, and Fast-RNN models in this research. This study was based on 2462 animal images that could threaten farm surroundings. The images were selected from common species that might create risks for farm animals, including birds of prey, pigs, cattle, sheep, foxes, jackals, and dogs. The collected data were converted to a standard size of 640 \(\times\) 640 pixels and divided into three main groups: training, validation, and testing. The data distribution was structured as 1721 images for the training set, accounting for 70% of the total data; 491 images for the validation set, accounting for 20%; and 250 images for the testing set, making up 10%. The numerical results of the experimental study are provided in Table 3.  
Upon careful examination of Table 3 according to the study analysis results, it is observed that the average successful detection values, mAP50, were 93.1% for YOLOv8, 93.1% for YOLO-NAS, and 91.2% for Fast-RNN. The YOLOv8 model exhibited high performance with 93% precision, 85.2% recall, and a 93.1% average accuracy rate (mAP50), indicating that the model mostly made accurate detections and successfully identified a large portion of the objects. Conversely, despite producing more false positives with a lower precision rate of 52%, the Yolo-NAS model achieved an exceptional recall rate of 98.7%, nearly detecting all true objects. The Fast-RNN model demonstrated balanced performance in precision (85.2%) and recall (91.8%), obtaining an overall effective result, with a mAP50 value of 91.2%. These findings showcase the capabilities of the developed models in detecting and tracking potential threats around the farm environment. The performance of the models was optimized appropriately for the dataset's characteristics, which included various animal species and reflected real-world conditions. Consequently, this study highlights the potential of object detection technologies in protecting farm animals and enhancing farm security. Significantly, the high precision and recall values of the YOLOv8 and Fast-RNN \begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Model** & **Epoch** & **Batch** & **Size** & **Precision** & **Recall** & **mAP50** \\ \hline YOLOv8 & 100 & 16 & 640 \(\times\) 640 & 0.93 & 0.852 & 0.931 \\ \hline Yolo-NAS & 100 & 16 & 640 \(\times\) 640 & 0.52 & 0.987 & 0.931 \\ \hline Fast-RNN & 100 & 16 & 640 \(\times\) 640 & 0.852 & 0.918 & 0.912 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Numerical results of the experimental study. models offer significant practical applications for farm management. The high recall rate of the Yolo-NAS indicates its particular strength in detecting all potential threats, making it valuable for specific applications. In assessing the utility of the models under different operational conditions, it was found that YOLOv8 delivered robust performance in environments characterized by high-density and complex backgrounds, thereby affirming its efficacy in crowded agricultural settings where precise and reliable detection is crucial. Concurrently, Yolo-NAS demonstrated its strengths in real-time monitoring scenarios, showcasing its capability in instantaneous threat recognition, which is essential in live monitoring systems that require immediate response to potential threats. Moreover, Fast-RNN proved to be particularly adept in resource-constrained environments, illustrating its potential applicability in edge computing devices deployed in remote farm locations where computational resources are limited. These findings highlight the adaptability of the models to varied operational demands, suggesting their broad applicability in enhancing farm security through advanced object detection technologies. Examining other metric values of the YOLOv8 model, it was observed that the study exhibited stable performance according to loss parameters. The decrease in loss values at the end of the study was interpreted positively for this work's analysis.