# Real-Time Farm Surveillance Using IoT and YOLOv8 for Animal Intrusion Detection
## 3 Results and Experiments
### Evaluation of the Models using the Secondary Dataset  
It is impossible to overstate the significance of verifying the performance of machine learning models on a secondary dataset. This stage is essential for evaluating the models' ability to generalize their learned patterns beyond the limits of the initial dataset. In real-world scenarios, these models will encounter data variances, distributions, and properties that differ from their training and validation sets. The addition of a new dataset simulates these real-world scenarios, ensuring that the models remain resilient and reliable when presented with previously unreported data. It contributes to demonstrating that the models' usefulness is not limited to specific data but extends to a broader range, increasing their practical use and bolstering their credibility. Figure 16 compares the results of the models in the classification of images from the secondary dataset. Figure 17 shows the confusion matrices for the performance of five different neural network models on the secondary dataset, including Inception, Xception, AlexNet, VGG, and Yolo V7, as well as their performance in classifying photographs into three categories: 'animal', 'clear', and 'human'. Notable results include the Inception model correctly identifying 38 of 39 'animal' images and the Xception model correctly classifying all 39 'animal' images. However, both Inception and Xception made slight misclassifications, most notably when distinguishing 'animal' from other categories. The AlexNet model struggles with 'clear' classification, which may reveal flaws in its category differentiation. VGG offers reliable findings that are comparable to Inception but differ in subtle ways. Yolo V6 made a few misclassifications, most notably between 'animal' and 'clear', as well as 'human'. On the other hand, Yolo V8 shows a notable improvement, with reduced misclassifications for 'animal' and 'clear' and perfect classification for 'human', suggesting improved accuracy in differentiating between these categories. The most accurate model is the Yolo V8, which achieved a flawless classification of all categories. Table 4 compares the performance characteristics of five neural network models: Inception, Xception, VGG16, AlexNet, and the versions of Yolo used. Inception scores a respectable 90% accuracy and recall, displaying a harmonic balance, with an F1_score of 90%. Xception maintains an accuracy of 90%, comparable to Inception, and a recall of 89%, resulting in an F1_score of 88%, favoring recall somewhat. VGG16 reaches a comparable accuracy of 89%, matching Xception's results. It attaing a 89% accuracy and recall, yielding an F1_score of 88%, matching the balance observed in Xception. AlexNet, on the other hand, trails significantly, with an accuracy of 68% and a precision of 63%. It has a recall rate of 68% and an F1_score of 62%, showing a substantial deficiency in balancing accuracy and recall. Yolo v6 and Yolo v7 have accuracies of 89% and 92%. With an astounding 98% accuracy and 99% precision, Yolo V8 emerges as the epitome of brilliance. It has an excellent balance, with a recall of 98% that matches its F1_score of 98%. Yolo V8 significantly beats its opponents in every category. Inception outperforms Xception and VGG16, which generate extremely similar outcomes. AlexNet, on the other hand, trails significantly across the board, signaling that it is inappropriate for applications demanding high accuracy or recall. \begin{table}
\begin{tabular}{c c c c c} \hline
**Model** & **Accuracy** & **Precision** & **Recall** & **F1\_Score** \\ \hline VGG16 & 95.67 & 95.87 & 95.67 & 95.29 \\ \hline AlexNet & 80.51 & 76.66 & 80.51 & 78.02 \\ \hline YoloV6 & 94.41 & 95.37 & 94.34 & 94.85 \\ \hline YoloV7 & 98.15 & 98.38 & 98.07 & 98.22 \\ \hline YoloV8 & 99.10 & 99.21 & 99.05 & 99.12 \\ \hline \end{tabular}
\end{table} 
Table 3: _Cont._Figure 16: Confusion matrices of the performance of the models on the secondary dataset.