Abstract
This paper presented a non-destructive approach for detection of intact and crack eggs using transmission imaging combined with support vector machine classifier. Two hundred brown chicken eggs, including 100 intact and 100 crack eggs were collected as samples. Transmission vision system was developed to capture the sample images. Green color component and edge algorithm based on confidence were then used to transform the color image into edge image for next analysis. Features (mean, variance and third moment) characterizing the differences between crack and intact eggs were extracted through analyzing projection functions as input vectors of the detection model. The detection model in this paper was conducted by support vector machine (SVM). Cracked and Intact eggs could be distinguished by SVM using the statistics parameters. Experimental results showed that the overall identification accuracy in training and test sets were 94% and 93% using 10-fold cross validation approach, respectively.
Introduction
Chicken egg which has rich nutrition value and high protein is one of the main foods in China, and it is popular among domestic and foreign consumers. Therefore, the quality and safety of eggs have been an issue of public concern. During the last decades, considerable effort is placed on the grading and spoilage research for egg products that affect egg quality [1, 2, 3]. Among the researches that need to be carried out on egg products is the detection of the cracks. It is for this reason that the cracks on the eggshell will maybe result in bacterial contamination such as Salmonella which has direct impacts on people’s health. So eggshell crack has become an important problem to be solved, and commonly emerged in the course of packing or transportation. Thus, in order to avoid potential bacterial contamination and health risks, cracked eggs must be detected before they are processed to avoid them being incorporated into intact ones for humans feed.
Detection of cracked egg is a critical process to prevent bacterial contamination and guarantee egg quality. Normally, the detection of cracked eggs is carried out manually by skilled or semi-skilled works using an egg candler. This may not be an entirely efficient method as workers are subject to external influences such as fatigue and work environment, and make classification and evaluation errors. Being subjective, traditional detection model possibly get poor performances. To make quick and accurate decisions about the detection between cracked and intact eggs, robust automated technologies are in high demand. Different automatic researches have been performed to detect eggshell crack [4, 5, 6]. The detection follows two methods in these researches. One method to detect cracked eggs is mainly based on acoustic response analysis. Amer Eissa [7] analyzed the frequency curves between intact and cracked eggs. The analysis indicated that the frequency spectra of intact eggs were almost distributed from 3000 Hz to 8000 Hz with only one the highest peak, whereas the frequency spectra of cracked eggs failed to provide any distinct trends from 2000 Hz to 10,000 Hz. Deng et al. [8] studies the inspection of eggshell cracks combined the Fourier frequency spectra analysis with continuous wavelet transform. The classification results showed that crack detection using wavelet features achieved 98.9% accuracy with a 0.8% false rejection. Cheng et al. [9] produced seven separate acoustic signals as characteristic vectors to analyze using the Mahalanobis distance. The analysis indicated that proposed signal features could detect 90% of the cracks with a 10% false rejection. Wang et al. [10] detected eggshell crack using acoustic resonance combined with time and frequency features. The authors evaluate the effect of every feature on the discrimination of sound and cracked eggs using F-ratio. Classification accuracy reached 99.2% using neural network. Some encouraging results for detection cracked eggs were obtained, but more investigation is needed to achieve reasonable and precise methods.
The other method to detect cracked eggs is by machine vision [11, 12]. This purpose using machine vision is to detect visually cracked egg. However, it is difficult to detect visually if the crack width small. Therefore, one approach recently is based on negative-pressure technique that causes widening of pre-existing cracks [13]. In this technique, it was observed that expansion of cracks in chicken eggs was displayed because of an abrupt pressure drop through an imaging system [14]. In addition, Li et al. [15] designed a visual system to detect micro-crack in eggshell using vacuum pressure 18 kPa. The result showed that the accuracy to identify the micro-crack could reach 100% meanwhile the whole system was not influenced by the dirt parts in the eggshell.
Despite the advances achieved so far, there is still much to be done. The current research was to explore a non-destructive method for detecting cracked egg using soft-margin support vector machine (SVM) models. The specific objectives implemented to accomplish this were as follows: (1) establish a transmission imaging system for acquiring eggshell images; (2) quantify the statistical parameters from projection functions for each image and explore crack-sensitive indicators; (3) develop a SVM classifier for differentiating intact and crack eggs.
Materials and methods
Samples
Two hundred brown chicken eggs of different weights were collected from a local hatchery farm, namely Jiufeng Chicken Farm in Wuhan, Hubei. The mass of the eggs ranged from 54.6 g to 68.8 g, and the average weight was 61.2 g. Two hundred eggs inspected by the researchers using an egg candler were classified as cracked or intact. The number of cracked eggs in the inspection was only 13, which didn’t meet experimental requirement. Therefore, crack initiations of 87 eggs were man-made from intact eggs. Before the experiment had been done, all the stains had been removed. The egg was placed on an egg-bed and the knock response on the eggshells was done with a steel rod which had a ball end with diameter of 10 mm. The strong impact on the eggshells causes a number of cracks that expanded from the point of knock into all directions. One hundred eggs of each variety (intact and crack) were prepared.
Experimental procedures
To validate the accuracy of the proposed method in this research, 200 egg samples were categorized as training and test sets. The first 100 samples were selected at random as a training set, including 50 cracked eggs and 50 intact ones. Each sample was carefully placed in the divided plate to capture their images based on vision platform. After that, these images were processed using image algorithms (gray, edge, removal of noise and thinning) and projection curves analysis, leaving the crack and boundary of egg to extract the features and to develop SVM classifiers. Another 100 samples were categorized as a test set, consisting of the rest of the egg samples. This test set was used to predict the performance of the proposed detection models. Note that the various positions of the crack in the sharp and blunt ends of eggs were not considered in our experiments.
Image acquisition system.
Typical samples of egg RGB images. (a) crack egg; (b) crack egg; and (c) intact egg.
Figure 1 displayed the system for egg image acquisition based on machine vision. It consisted of the following components: CCD image sensor, an aluminum alloy box, illuminator and a computer. The CCD image sensors captured egg samples include a UI-2230ME-C-type camera by German company and the VS-LD4-type lens by Japan. A 32 W lamp as a transmission illuminator was fixed on the internal bottom of the box. Egg sample was placed 20 mm above the illuminator on the black divided plate with an ellipse hole. The length and width of the ellipse were 45 mm and 35 mm, respectively. And the hole was in direct line with the lamp. When acquiring images, the system was enclosed in a dark box to prevent exposure while the lamp was lighted, and the crack regions were clearly shown in the image acquisition software. All images were saved in raw format. Several typical sample images were shown in Fig. 2.
Image processing
Before the cracks in eggshell were identified by the classifier, detection of edge for cracked and intact egg images played an important role. Cracks in the eggshell showed similar characteristics as boundary of egg where gray values abruptly changed. Based on this, the previous researches attempted to remove the edge or boundary of egg leaving only the cracks in the image for next feature extraction, which probably caused removal of the small cracks. Therefore, the information combined the crack with edge of eggs would be kept in this paper.
Image processing. (a) grey-scale images; (b) edge images; and (c) edge images after removal of the noise.
Crack or intact egg in each image was segmented from the background. Figure 3 showed sample egg images of Fig. 2. First, the original images were transformed into grey-scale images by considering only the green color component of RGB images (Fig. 3a). Next, edge algorithm based on embedded confidence was used to produce a complete edge image (Fig. 3b). The proposed edge detection procedure integrated confidence measure into traditional gradient-based edge detector, which was reported by Peter and Bogdan in 2001 [16]. This method had the ability to characterize the entire image with a single vector, and hence, it was more sensitive to complex disturbances such as lightness and small cracks [17]. After egg edge segmentation was complete, a mathematical morphology method was applied to remove any noise (Fig. 3c). And it could be seen that the edge image of cracked egg consisted of three subjects: background (black), boundary of egg (white) and crack (white), whereas the intact one consisted of two subjects: background (black) and boundary of egg (white). Crack and intact egg contours varied considerably.
Projection curves of the samples from Fig. 3c. Left panel: Vertical projection. Right panel: Horizontal projection.
To describe the characteristics of the crack and intact eggs, statistic features were quantified for the crack and intact eggs. The statistic traits included the mean value (mean), variance value (variance), and third moment value (moment). To calculate these traits, the egg contours were first converted into histograms by using vertical and horizontal projection transform. Projection histograms were then normalized by Min-Max scaling operation (Fig. 4). Crack eggs had a series of peaks, whereas intact eggs almost showed a straight line in the range of 200–350 of vertical projection curve or in the range of 150–400 of horizontal projection curve. The statistic traits could represent the major variations. Projection histograms were 1-dimensional. The 6 traits were subsequently calculated from vertical and horizontal projection functions following the below definitions.
Where
In the task of crack detection, a cracked egg detected as crack is a True Positive (TP) while a True Negative (TN) is an intact egg detected as intact. False Negatives (FN), on the other hand, are cracked eggs misclassified as intact ones. In certain industrial applications, such as crack detection, along with the overall accuracy of the detection system, the FN is also an important factor. Any system with a higher accuracy but substantial number of FNs may signify higher risk because if the cracked eggs are left out, they may quickly deteriorate and spread to cause food safety. In order to gage the performance in this regard, along with the accuracy, three other metrics are used:
where FP is the number of false positives (intact eggs detected as crack). FR is the false rejection, and Sensitivity denotes the crack detection rate. Therefore, Accuracy, Sensitivity and FR are used for the performance evaluation of crack detection in this study.
Support Vector Machine is applied for differentiating the crack and intact eggs. The main principle of SVM is to build up an optimal hyper-plane, which can solve the two-classification problem with the maximum margin using the statistical learning theory [18, 19, 20, 21, 22, 23]. The principle process is explained as follows. Considering the two-classification problem, given a training set
where
where the function
SVM is originally used to process linearly separable cases. But not all the problems can be linearly separated. When meeting with non-linear cases, this linear classifier may not work well. Using kernel technology can effectively solve this problem. The following kernel function is commonly used along with SVM:
RBF kernel:
where
Classification results for soft-margin RBF-SVM classifier
Distribution of statistics from vertical projection function for 50 cracked and 50 intact eggs. Left: Mean values. Middle: Variance values. Right: Values of the third moment. Note that “
Feature parameter extraction
Figure 5 showed the statistics distribution of mean, variance, and third moment from vertical projection for 100 samples, including 50 crack and 50 intact eggs. Variations in the distribution were observed. Crack eggs were very difficult to distinguish from the intact eggs if single feature was used.
Figure 6 showed the statistics distribution of mean, variance, and third moment from horizontal projection among the 100 eggs. Variations in the distribution for the 50 eggs of each variety were observed. These observations indicated that single feature was difficult to distinguish the crack egg effectively.
Consequently, a combination of the above six features was used to construct SVM model in this study.
Classification using SVM classifier
In this subsection, the soft-margin SVM models were applied to classify all training/test images into two classes as cracked and intact using the 6 projection statistics features from the 200 eggs. In the experiment, radial basis function (RBF) kernels were used. Some parameters (
Table 1 showed the classification accuracies of the crack and intact eggs from the training set.
Some percentages for the crack detection values obtained in earlier reports
Some percentages for the crack detection values obtained in earlier reports
Distribution of statistics from horizontal projection function for 50 cracked and 50 intact eggs. Left: Mean values. Middle: Variance values. Right: Values of the third moment. Note that “
Figure 7 showed the ROC curves with
In order to verify the performance of the soft-margin RBF-SVM model, the same process was applied using the test data. The RBF-SVM classifier using the above six features achieved an averaged accuracy of 93%, a sensitivity of 68% and a FR of 0%. Some crack detection percentages that were published in earlier studies are shown in Table 2.
The experimental results indicate that the features, based on projection curves extraction, seem to be an efficient method having high level of accuracy, but more further study will be carried out for industrial purpose. One limitation in using image-based approach for detecting crack is that crack should be distinct. But the positions of crack initiations in the sharp and blunt ends of eggs and dirt on the eggs were not considered in our experiments, this might affect the generalization capacity of the RBF-SVM model. In fact, the shape of egg is ellipsoidal. It is a complex task and needs a further study on accurately identification the crack features of the eggshells. This research implemented to estimate cracks of egg samples, which provides a foundation for more accurate quantitatively study on identification crack features of the eggs.
ROC curve with their respective AUC values. (a) the classifier with features from vertical projection (AUC 
In this research, a nondestructive approach for detecting crack eggs from intact eggs was presented. For our experiment, a combination of six statistical features which characterized crack and intact eggs in images from projection curves were used to construct soft-margin RBF-SVM classifier. The experimental results demonstrated that the proposed features could be used to detect crack eggs with overall accuracy of 93%. In the future, it will be necessary to develop an online method for automatic detection of crack eggs. So the projection analysis can provide a new thought for detecting crack-sensitive features by applying the image processing technique to auto-detect eggshell crack question.
Footnotes
Acknowledgments
This research is supported by the Grant of the National Natural Science Foundation of China (No. 31371771), and the Fundamental Research Funds for the Central Universities (No. 2015PY078).
