# Real-Time Farm Surveillance Using IoT and YOLOv8 for Animal Intrusion Detection
## 3 Results and Experiments
### Evaluation of the Models on the Test Set of the Primary Dataset  
The assessment of machine learning models on the test dataset serves as a vital litmus test, offering an important benchmark for evaluating their real-world performance. The importance of this testing process stems from its capacity to replicate the models' performance in the face of unique, previously unknown data, simulating the real-world conditions in which these models would be applied. It enables the evaluation of their generalization capacities, the measurement of their accuracy, and the uncovering of latent faults like overfitting that may have gone unnoticed throughout the training and validation stages. As a consequence, evaluating these models on the test dataset highlights their dependability and durability before they are used in production. The four aforementioned machine learning models--Inception, Xception, VGG16, and AlexNet--along with the pretrained YOLOv8 model, are utilized effectively within this study to conduct a comprehensive evaluation of their performance on the test dataset. This thorough research is crucial for assessing their usefulness in real-world situations, notably in the detection of agricultural incursions. When evaluated against previously unknown farm surveillance data, this approach provides a comprehensive assessment of these models' capabilities in terms of accurate identification and categorization, thereby reinforcing the foundation of the system's reliability and efficacy. Figure 14 compares the results of the models in the classification of images from the test dataset. The confusion matrices for four alternative neural network models are depicted in Figure 15: Inception, Xception, AlexNet, and VGG. These matrices depict the models' categorization performance across three categories: 'animal', 'clear', and 'human'. The Inception model excels at correctly categorizing the 'animal' category, with just two misclassifications as 'human' and none as 'clear'. The 'clear' class classification is practically flawless, with 19 accurate identifications and 1 erroneous identification as 'human'. In the 'human' category, 16 photographs are accurately identified, while 4 are mislabeled as 'animal'. The Xception model does an excellent job, properly classifying 190 photographs in the 'animal' category. In the 'clear' category, it made 19 correct choices and only one misclassification as 'animal'. Its 'human' categorization, on the other hand, is less precise, with 12 proper classifications and 8 photographs mistakenly labeled as 'animal'. Moving on to AlexNet, the 'animal' class contained 178 valid identifications, with 6 and 7 misclassifications as 'clear' and 'human'. The 'clear' class was chosen erratically, with 5 correct identifications and 15 misclassifications as 'animal.' The 'human' class produced unpredictable results, with 16, 1, and 3 photographs tagged as 'animal', 'clear', and accurately identified as 'person', respectively. Finally, in the 'animal' category, the VGG model performs brilliantly, properly categorizing 189 photographs, with only one error for 'clear' and 'human' each. In comparison to Yolo V6, which occasionally misclassified objects as either 'animal' or 'person', Yolo V7 significantly improved, showing fewer misclassifications and a larger percentage of true positives--a sign of increased model performance in terms of accurately identifying the given classes. The 'clear' class exhibited precise identification by Yolo V7, while the Yolo V8 model stands out, with 189 images correctly recognized as 'animal', and only 2 images misclassified as 'clear' and none as 'human'. The 'clear' and 'human' classes were identified beautifully, with all 20 photographs accurately detected without errors. The performance characteristics of five distinct neural network models are compared in Table 3. These models are Inception, Xception, VGG16, AlexNet, and the versions of Yolo used.