| Apple detection and grading is a necessary step for apple to enter the market.At present,the main method of apple detection and grading in China is manual visual testing.However,there are some problems in manual grading,such as low labor force,strong subjectivity and high cost.In order to solve the above problems and upgrade the apple industry to meet the needs of domestic and foreign markets,this paper puts forward an algorithm for apple external quality detection and grading based on deep learning.The main contents of this paper are as follows:(1)According to the requirements of the experiment,the apple image acquisition device was designed and set up.The components of the apple acquisition device and the parameters and selection of the components were described;The collected apple images are normalized,and the apple dataset is made by image expansion,image labeling,image data division,and so on.Pre-treatment and foreground segmentation of the external defective apples were carried out to prepare for the external feature extraction of the apples in chapter 4.(2)In order to solve the problem of missing detection and inaccurate location in apple surface defect detection,a fast positioning and recognition algorithm(YOLOAPPLE)for apple surface defect based on improved YOLOV3 model is presented.The algorithm replaces three residual blocks in the backbone extraction network of YOLOV3 with three dense blocks,and improves the feature propagation between dense blocks combined with average pooling to achieve the reuse and fusion of feature information,thus reducing the miss detection rate.On this basis,CIOU bounding box is added to regression loss,which makes prediction box positioning more accurate.Secondly,the Kmeans clustering algorithm is used to cluster the ground truth of the apple defect dataset,and a priori box that more closely matches the apple defect is obtained,so as to improve the accuracy of the model.The average accuracy of YOLO-APPLE model is 93.53% and the detection speed is 43 FPS.(3)To study and extract the external characteristics of apples.For apple diameter size,apple diameter was extracted by the minimum circumferential circle method.For apple fruit shape,the concept of roundness was used to describe the characteristics of apple fruit shape.In the aspect of apple color,the ratio of red H component to apple image can be calculated using HIS color space to obtain the red color ratio.(4)In order to improve the accuracy of apple external quality grading based on support vector machine,a support vector machine apple grading algorithm(IGWO-SVM)based on Improved Grey Wolf algorithm parameter optimization was proposed.Based on the standard Grey Wolf Optimization algorithm,an Improved Grey Wolf Optimization algorithm(IGWO)is proposed by using Logistic chaotic mapping to initialize population,improve non-linear convergence factor and introduce Cauchy mutation.The penalty factor C and kernel function parameters σ in the support vector machine are optimized by using the IGWO,and the optimal IGWO-SVM classification model is obtained.Finally,compared with the classification results of SVM and GWO-SVM,the results show that the highest classification accuracy of IGWO-SVM can reach 98.33%. |