Objective In response to the problem of slow speed, narrow categories, and poor detection of small-target pests in existing forestry pest detection methods, a forestry pest detection method base on improved YOLOv8n was proposed.
Method Firstly, an efficient multi-scale cascade attention feature extraction network EfficientViT was adopted as the backbone of the improved model to reduce computational complexity and enhance detection speed. Secondly, a multi-scale adaptive feature fusion module DA-C2F was constructed to improve the model’s ability to focus on and accurately identify pest targets in complex backgrounds. Additionally, a newly added small-object detection head XSH further enhanced the detection capability for small pest objects. Finally, a minimum point distance IoU loss function MPDIoU was implemented as the bounding box loss for the model, accelerating convergence speed and further improving the accuracy of pest target localization.
Result The improved model achieved a detection precision of 98.6%, recall of 95.7%, mean average precision of 98.3%, mean average precision at different thresholds (mAP50-95) of 85.6%, 95 frames per second, and an F1-score of 0.979. These metrics represented improvements of 3.9, 2.6, 2.8, 2.5 percentage points and 4.4%, respectively over the original model. The detection speed reached 95 frames per second with an improvement of 15.9%, also surpassed that of the lighter-weight model. Furthermore, in comparison with other detection models, the improved model demonstrated an increase of 11.2 percentage points in detection precision for moth pests, and exhibited superior overall performance in the detection of two independent moth pest species.
Conclusion The proposed method has higher detection accuracy and faster detection speed for forestry pests, better detection accuracy for multiple categories of pests, and better generalization ability of the improved model.