Abstract:Considering that the existing pest detection algorithms face challenges such as large computation and parameter requirements, as well as low detection accuracy, an improved lightweight agricultural pest detection algorithm was proposed based on YOLOv7. Firstly, lightweight GhostNetV2 and PConv modules were introduced into the backbone and neck networks, reducing the network's parameter and computational load while minimizing the channel redundancy. Secondly, the deformable large kernel attention(D-LKA) mechanism was incorporated to enhance the model's ability to capture irregularly shaped target information. Additionally, the attention-based intra-scale feature interaction(AIFI) module was employed in the neck network to improve intra-scale and inter-scale feature interaction. Finally, to address the issue of feature loss due to feature fusion, the CARAFE upsampling operator was introduced to increase the model's receptive field, promote the feature information flow and reduce feature loss. The results showed that compared with YOLOv7, the improved algorithm achieved a pest detection accuracy of 72.1%, with a 43.4% reduction in parameter number and a 37.0% decrease in computational load. This proposed detection algorithm not only achieved model lightweighting but also enhanced detection accuracy, providing valuable reference for research in agricultural intelligent machinery.