Classification and detection of fruit quality is very significant for fruit producing,processing,transporting and selling.However,the traditional fruit detection algorithms are in poor generalization ability and robustness,because they require manual design features,and manually designed features are only for specific applications.In recent years,with the development of artificial intelligence technology,the performance and speed of object detection algorithm model for fruit detection based on deep learning have been continuously improved.However,most current fruit detection algorithms are applied for the single fruit type or morphology.Due to the big size of the algorithm model,it is difficult to train with high precision and speed at the same time.And it cannot be deployed and applied in the mobile platform.Therefore,to address the problem of detection of fruits with different shapes or varieties,this paper proposes two detection methods based on YOLOv5.The contributions of this paper are as follows.1.This paper creates a fruit images dataset.Firstly,four fruits images with different shapes including apple,orange,banana and pear are gathered from on-field and web crawler.Then Label Img software is used to label the each image.Finally the data is segmented and a dataset containing 2190 fruit images is successfully constructed.2.This paper proposes a fruit quality detection and classification scheme based on YOLOv5.In order to improve the precision and speed of conventional deep learning detection,a fruit quality detection and classification scheme based on algorithm YOLOv5 is proposed.The results show that the average detection accuracy of YOLOv5 s algorithm for detection and classification of fruit quality can reach 95.3%,which is 3.7%,0.2%,13.1% and 8.73% increase compared with YOLOv3,YOLOv3-spp,YOLOv3-tiny and YOLOv4-tiny,respectively.The inference time of the algorithm per image is 10.5 ms,which has a certain advanced nature.3.This paper proposes an improved YOLOV5 model with attention mechanism for fruit quality detection and classification,which aims at the problem that the original YOLOv5 network model had the large number of parameters and defective detection performance.Firstly,the original feature extraction network is replaced into Bottleneck CSP_small with a lightweight structure,which reduces the number of parameters and simplifies the network model.Secondly,the SENet module is added to the end of the backbone part,which makes the network pay more attention to the target and improves the detection precision and speed.At the same time,in order to improve the generalization ability of the algorithm model,the experimental data set is optimized by deleting the single background image of the constructed dataset and intensifying the fruit images with complex background.The optimized data set contains 2140 fruit images.The experimental findings demonstrate that the average accuracy of the improved YOLOv5 model reaches 96.3%,which is 2.4% higher than that of the original model,and the detection time of a single image is also reduced by 0.5 ms. |