During the production,transportation,packaging and storage of eggs,when it is squeezed by vibration or the environment is too wet and overheated,it will produce defective eggs with cracks in the shell or blood filaments inside.These eggs are easy to be invaded and deteriorated by bacteria.Detecting whether eggs have defects is very important to ensure food safety.At present,the quality of eggs can be detected by manual observation,chemical analysis,machine vision,spectral analysis and other technologies.However,most of the detection devices are fixed on the production line,there will be problems such as high cost and high loss,and it is not convenient to serve ordinary consumers.Therefore,it is of great practical significance to study the portable nondestructive testing technology of defective eggs.This paper takes the powdered egg as the research object,constructs the defective egg detection model combined with image processing and deep learning technology,builds a defective egg real-time recognition app on the Android platform.Combined with the self-designed portable device,it can nondestructive detect whether the egg has defects.The specific research contents are as follows:(1)A portable egg image acquisition device is designed.In view of the disadvantages of the traditional egg detection device,such as huge volume and high price,a portable image acquisition black box is designed.The black box structure is lifting and adjustable.At the same time,the positive white light single bead LED spotlight and the lower transmission lighting mode are selected to reduce the influence of environmental factors in the process of image acquisition and ensure the shooting quality of later images.(2)A defective egg detection model based on image processing is established.The original image of egg is preprocessed by graying,background removal and feature enhancement,and the characteristics of crack and blood spot are extracted.The detection models of crack egg and blood spot egg are established respectively.For cracked eggs,a classification model based on support vector machine is established with the length width ratio and roundness of the circumscribed rectangle as the parameters of the largest feature in each image,and the recognition accuracy is94.2%.For the eggs with blood spots,all connected regions of the egg image are extracted under the optimal threshold,and the proportion of blood spots is calculated to determine whether they belong to the eggs with blood spots.The comprehensive recognition rate is 75.8%.The results show that the crack egg can be distinguished effectively by extracting the defect characteristics of the egg and establishing the model.(3)Aiming at the image acquisition function of Android mobile terminal,a defective egg(crack and blood spot)recognition model based on deep learning is established.Considering the limitations of transplanting the model to the mobile terminal,the lightweight convolutional neural network Mobile Net V2 is selected from the factors such as the amount of model calculation,memory size and recognition accuracy.By embedding the coordinate attention mechanism into the original network,introducing the feature fusion structure and setting the width factor,the volume of the model is reduced by 31.0% and the accuracy is improved by 3.6%.Finally,the three classification recognition rates of cracked eggs,blood spotted eggs and normal eggs reached 98.4%,91.5% and 94.9% respectively,and the comprehensive recognition rate was 94.9%.(4)A nondestructive testing software for defective eggs based on Android system is developed.Compare the recognition speed,library file size,CPU occupancy and other factors of the model under the two mobile end deep learning frameworks of Tensor Flow Lite and NCNN and choose to use the NCNN framework for model transplantation.The format of the defective egg recognition model is converted and deployed through the neural network exchange(ONNX),and the nondestructive detection of the defective egg through the mobile terminal is realized.The recognition accuracy is 92.70% and the average detection time is 0.221.The software app also adds auxiliary functions such as account setting,egg variety and origin query,consultation and collection to improve users’ experience. |