| According to agricultural data released by China’s Bureau of Statistics in 2015,tomatoes account for about 10 percent of the country’s vegetable output,but the current picking pattern in China still relies on manual picking,which requires a lot of time and energy.In the current research on tomato detection,the detection model is too large and the detection is not accurate enough,which can not meet the needs of real-time picking robot.Therefore,in order to solve the problem that the detection model of tomato is too large at present,this paper carried out lightweight processing based on YOLOv4 model.In order to solve the problem that the target is not easily identified by occlusion in the lightweight network,this paper constructed a cross-dimensional attention mechanism module on the YOLOv4-m3 model with the best experimental performance in lightweight,and enhanced the detection effect of the network on the occlusion tomato.The main work of this paper is summarized as follows:(1)MobileNet network is used as the feature extraction module of the detection model,and deep separable convolution operation is used to replace conventional convolution operation to reduce parameter capacity and improve real-time operation.In order to improve the training effect of the network model,this paper firstly pretrains the model on the public data set,and then adjusts the parameters.The experimental results show that the size of the improved model is reduced to one fifth of that of YOLOv4,and the detection time of the model is significantly shortened on the premise of ensuring the detection accuracy.(2)Considering the insufficient feature extraction capability of lightweight network,two attention mechanisms,squeezing excitation module(SE)and convolution block attention module(CBAM),are added to the path aggregation network to enhance the feature extraction capability of the model in spatial and channel dimensions.Ablation experiment was conducted to study the effect of adding different attention mechanisms on the detection performance of the model.Compared with YOLOv4-m3 model,the model adding two attention mechanisms had the best detection effect on the detection effect of obscured tomato,and the m AP value increased by 5.36% compared with YOLOv4-m3.(3)At the Web end,the tomato maturity detection system is built by using the Flask framework of Python language.After analyzing the actual demand and resource configuration of Android system on the mobile terminal,the improved tomato maturity detection model is deployed to the mobile terminal,realizing the lightweight tomato detection system based on mobile devices,which can meet the demand of tomato maturity detection. |