| Apple plays an important role in the production of fruits in China,which accounts for more than half of the world’s apple production and planting area.However,China’s apple commercialization classification technology is still mainly based on manual classification and mechanical classification,and the classification standards are not unified,so it is difficult to ensure the classification quality and lack of competitiveness in the international market.Therefore,improving the quality of apple classification is the key to enhance the competitiveness of apple in the international market.In this paper,the Red Fuji apple is taken as the object to study the external quality detection method of apple.The main research contents are as follows:(1)For the apple image,RGB and HSI color models are used to process the apple image.According to the background characteristics of the sample image,the dual peak threshold segmentation method is used,and the difference histogram of R component and B component is used to segment the background.In addition,the peak signal-to-noise ratio(PSNR)and structure similarity(SSIM)of mean filter,gaussian filter and median filter are calculated respectively.The results show that the median filter is better than the other two filtering algorithms.Combined with the subjective judgment of the human eye,the median filter algorithm is selected to denoise the image.(2)When extracting the external quality features of apples,the external features such as color,fruit shape,fruit diameter and defects were extracted.In the part of color feature extraction,two parameters of color and color distribution are calculated respectively.The ratio of red and near-red H value in apple image is calculated to represent color index.The variance of R,G and B components is selected as the color distribution parameter by Fisher coefficient method.In the part of fruit shape feature extraction,the minimum external rectangle of apple is obtained by Canny algorithm,and then the fruit shape index is calculated.In the part of fruit diameter feature extraction,the pixel diameter of apple is obtained by the minimum circumscribed circle of the image,and the conversion between the pixel fruit diameter and the actual fruit diameter is realized based on the pixel equivalent.In the part of defect feature extraction,according to the difference of gray level between defect area and normal area,morphological operation and hole filling are introduced to segment defect area completely,and the ratio of defect area to apple area is taken as defect feature.(3)When the external characteristic parameters are used for classification,the BP neural network classification method based on genetic algorithm optimization and support vector machine classification method based on particle swarm optimization are studied.First of all,the classification standard of Red Fuji apple and the composition of 300 apple sample databases are given.In the study of BP neural network classification,the number of hidden layers in the structure of BP neural network is 1,the number of neurons in the input layer is 7,the number of neurons in the output layer is 4,the number of neurons in the hidden layer is 15,the incentive function in the hidden layer is sigmoid,the function in the output layer is purelin,and the learning rate is 0.2.In addition,the realization process of BP neural network optimized by genetic algorithm is described in detail.The traditional BP neural network and BP neural network optimized by genetic algorithm are respectively used for classification research.The results show that the classification accuracy of optimized BP neural network is 94%,which is significantly higher than that of traditional BP neural network.In the study of SVM classification,radial basis function is determined as kernel function through experiments,and one-to-one method is selected to build classifier according to the characteristics of samples.In addition,the implementation process of particle swarm optimization support vector machine is analyzed,and the optimal penalty factor is 0.61622 and kernel function parameter is 2.3041.The traditional support vector machine and particle swarm optimization support vector machine are respectively used for classification research.The results show that the classification accuracy of the optimized support vector machine is 95%,which is significantly higher than the traditional support vector machine.The experimental results show that the detection and classification method used in this paper has a good effect. |