Development of an AI-Driven Pest Detection and Control System Using YOLOv8 and ESP32-CAM
Keywords:
Artificial Intelligence, YOLOv8, ESP32-CAM, IoT, Pest Detection, Precision AgricultureAbstract
This study aims to develop an AI-driven pest detection and control system to enhance agricultural productivity and sustainability by enabling real-time pest identification and automated, targeted interventions, particularly for smallholder farmers in resource-constrained regions like Nigeria. The system integrates the You Only Look Once version 8 (YOLOv8) deep learning algorithm with an ESP32-CAM microcontroller for real-time pest detection and control. A custom dataset of 151 pest images (e.g., cockroaches, rats) was compiled, annotated, and processed using the Roboflow platform. The YOLOv8 model was trained over 18 epochs, exported for on-device inference, and interfaced with a relay module to activate a pesticide-dispensing pump. Performance was evaluated using accuracy, precision, recall, F1 score, and mean Average Precision (mAP). The system achieved a detection accuracy of 95.0%, with precision of 93.0%, recall of 92.3%, and an F1 score of 94.0%. The [email protected] reached approximately 0.45, indicating robust detection and localization. The dataset size (151 images) limits generalizability across diverse pest species and environmental conditions. The prototype’s enclosure is not fully weatherproof, restricting outdoor deployment. The system relies on a single control mechanism (pesticide pump), limiting flexibility. The system enables early pest detection and targeted interventions, reducing crop losses and pesticide overuse. Its low-cost, offline design using the ESP32-CAM makes it accessible for smallholder farmers, enhancing agricultural efficiency and profitability.