| In order to ensure the high quality of granular crops,testing is required during the actual production process.However,due to the wide variety of granular crops and the interference of debris in the environment,false detections and missed detections are prone to occur.At the same time,traditional color sorting equipment has high requirements for light,and expensive optical path components need to be designed to maintain stable light conditions.In this paper,peanuts,melon seeds and red dates are used as examples to construct a granular crop detection data set,to study the granular crop detection algorithm based on YOLO,to achieve a higher detection accuracy while maintaining a faster running speed.First,design a granular crop detection platform.Build a model training platform based on Mist GPU cloud computing and a model deployment platform based on Raspberry Pi 4B.Collect images containing peanuts,melon seeds and red dates under different backgrounds and different light conditions to construct a granular crop detection data set.Methods such as single-sample data enhancement and multi-sample data enhancement are used to enrich the background of the image to avoid over-fitting of the detection algorithm on the data set.Secondly,study the transfer learning algorithm based on YOLO.Determine the inspection and evaluation standards of granular crops around the accuracy index and real-time index.Develop a migration learning strategy based on YOLO,including clustering algorithm generation a priori box,granular crop detection task allocation and loss function design.Optimize the training process through the hot restart mechanism,and complete the training based on the pre-training model.The test results show that the migration learning algorithm based on YOLO has strong robustness to changes in background and light conditions,with a detection accuracy of 98.83%,but the average running time for processing a single image on the CPU is 768 ms,and the real-time performance is poor..Then,the detection algorithm of lightweight granular crops is proposed.The quantitative relationship between the convolution kernel and the receptive field was analyzed,and a lightweight granular crop detection network based on the three-level controllable receptive field structure and the feature map down-sampling structure was designed.In order to improve the detection performance,the bottleneck structure design and the residual structure embedding are carried out to realize the improvement of the convolutional layer topology.Compared with the experimental results of the YOLO migration learning algorithm,the detection accuracy of the proposed algorithm on the granular crop detection data set is increased by 0.4%,the running time is reduced by95%,and the model size is reduced to 1.33‰.In order to perform multi-scale detection,the designed algorithm is extended based on the hole convolution.Finally,study the model compression algorithm and complete the deployment.Visualized analysis of the network layer channels of the lightweight granular crop detection algorithm,designed the channel importance standard and proposed a channel pruning framework based on the relative activation rate.TFLite is used to further quantify the model,and the algorithm before and after the model compression is deployed to the Raspberry Pi 4B platform for testing.The results show that the lightweight granular crop detection algorithm after model compression can improve real-time performance and reduce storage resource usage. |