Food is the foundation of social stability,but in the process of food storage,food losses due to pests reach millions of tons each year.How to quickly and effectively detect and identify granary pests is a key step to solve the problem of food storage safety.With the development of computer vision,detection and recognition by machine learning has become the mainstream,but the detection speed is slow and the robustness is not high.How to accurately and effectively detect granary pests has become a top priority.This thesis proposes an improved YOLOv5 s network to detect and identify granary pests,and a granary pest monitoring system is designed and implemented.The main work of the thesis is as follows:1.A multi-scale feature fusion network BAR-YOLOv5 based on attention mechanism is proposed.First,the Bi FPN feature pyramid structure is fused into the YOLOv5 network to strengthen the fusion of network features and improve the detection of small targets;The channel attention mechanism and the spatial attention mechanism are introduced into the CSP module to enhance the network’s extraction of key features of pest images;Using the characteristics of the Res Ne Xt residual unit,the grouped convolution is introduced into the CSP module,so as to improve the accuracy of the network for pest detection and reduce the network computation.The test results show that on the AI insect recognition dataset,the m AP of the BAR-YOLOv5 network increases from 87.5% to 91.1% compared to the YOLOv5 network.2.In view of the long training time of the YOLOv5 network and the problems of detecting multiple anchor boxes during the pest counting process,the thesis proposes the BAR-NMSYOLOv5 s granary pest detection network,which detects and counts 6 common granary pests against a white background.The transfer learning method is used to optimize the training process,and DIo U is used to screen anchor boxes and optimize the execution process of the NMS algorithm to reduce the generation of duplicate anchor boxes.The test results show that the training time of the BAR-NMS-YOLOv5 s granary pest detection network is reduced by 80%,and the m AP reaches94.1%.3.Based on the BAR-NMS-YOLOv5 s granary pest detection network,a granary pest monitoring system was designed and implemented.The main functions of the system include granary parameter setting,trap monitoring and granary inspection.The system was deployed on the Alibaba Cloud server and tested.The test results show that each function of the system meets the actual demand,the error rate of pest count is low,and the average detection time is 0.33 seconds. |