Lightweight crop pest detection method based on attention mechanism and YOLOv5s
To address the low accuracy and slow speed of manual pest detection in natural environments,a lightweight object detection algorithm based on attention mechanism and YOLOv5s is proposed.Firstly,the Ghost convolution is used to replace the vanilla convolution in YOLOv5s,obtain a lightweight backbone feature extraction network.Secondly,a weighted bi-directional feature fusion mechanism is integrated into YOLOv5s to efficiently perform bidirectional cross-connections and multi-scale feature fusion.Finally,the coordinate attention mechanism is added to the backbone network to enhance the model's focus on spatial information.Compared with YOLOv5s,the proposed algorithm achieves a 2.1%improvement in the mean average accuracy on the IP102 crop pest detection dataset,with a reduction of 44.6%in the number of model parameters and 44.3%in the amount of computation,and a detection speed of 64.8 FPs.The experimental results show that the lightweight object detection algorithm based on attention mechanism and YOLOv5s not only improves the accuracy of crop pest detection,but also significantly reduces model parameters and computational complexity,which can meet the application requirements of crop pest detection.