# Real-Time Farm Surveillance Using IoT and YOLOv8 for Animal Intrusion Detection
## 2 Methodology and Implementation
### Intrusion Detection
#### 2.1.9 Model Deployment  
While several machine learning models were investigated, including Inception, Xception, VGG16, and several versions of YOLO, YOLOv8 was chosen for its better real-time detection capabilities. Unlike other models that need large computing resources, YOLOv8 strikes an efficient balance between speed and accuracy, making it particularly ideal for implementation in IoT devices such as ESP32, which possesses a small processing capacity. Other models are mentioned for comparative purposes and were found to be less successful  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline
**Model** & **Architecture** & **Detection** & **Detection** & **Training Dataset Size** & **Hardware Compatibility** \\ \hline \multirow{2}{*}{Inception} & Traditional CNN & Moderate & High & Large & GPU \\ \hline \multirow{2}{*}{Xception} & Depthwise Separable Convolution & High & High & Large & GPU \\ \hline \multirow{2}{*}{AlexNet} & Standard CNN & Moderate & Moderate & Moderate & CPU/GPU \\ \hline \multirow{2}{*}{VGG16} & Standard CNN & Moderate & High & Large & GPU \\ \hline \multirow{2}{*}{Yolo Models} & Single-Shot Detection & High & High & Moderate & GPU \\ \hline \hline \end{tabular}
\end{table}
Table 2: Comparison of object detection models.  
in addressing the unique criteria of this system, with notably low latency detection in a farm context.  
After the assessment of their performances, the model that outperformed others and emerged as the ideal choice for deployment was YOLOv8. Its excellent combination of object detection speed and precision, together with its novel single-shot design, positioned it as the favored model for the SFSS.  
The deployment method used entails hosting the specified model on a cloud server. This server design is suited for effective and scalable object detection activities, providing the required resources for real-time processing.  
The operation begins with the transfer of live video feeds from the agricultural area to the cloud servers, enabled by microcontrollers. These servers provide two functions: they store the constant stream of data from the farms and house the deployed machine learning model responsible for intrusion detection.  
Intrusion detection happens within the cloud environment, exploiting the capabilities of the YOLOv8 model. The system regularly examines the camera stream for indicators of infiltration, closely monitoring the fields. Upon sensing an unlawful presence, whether animal or human, the warning system is immediately triggered.  
The alert system has a number of aspects. Initially, an alert is generated to prevent prospective intruders, whether they be persons or animals posing a hazard to the crops. This alert serves as a substantial deterrent, urging would-be attackers to escape and averting probable harm.  
Simultaneously, the cloud server sends an SMS alert to the field owner, warning them of the breach. This real-time warning is a vital component of the system, enabling owners to take rapid action in reaction to recognized dangers.  
In essence, the model deployment procedure simplifies the entire operation. It merges the high-performance capabilities of the YOLOv8 model with cloud server architecture, generating a powerful, real-time, and rapid intrusion detection and alarm system for the security of agricultural areas.