Next Article in Journal
Random-Access Accelerator (RAA): A Framework to Speed Up the Random-Access Procedure in 5G New Radio for IoT mMTC by Enabling Device-To-Device Communications
Next Article in Special Issue
Wide Field Spectral Imaging with Shifted Excitation Raman Difference Spectroscopy Using the Nod and Shuffle Technique
Previous Article in Journal
Prediction of Sudden Cardiac Death Risk with a Support Vector Machine Based on Heart Rate Variability and Heartprint Indices
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Nondestructive Detection for Egg Freshness Based on Hyperspectral Scattering Image Combined with Ensemble Learning

1
College of Artificial Intelligence, Nanjing Agricultural University, Nanjing 210031, China
2
Jiangsu Province Engineering Laboratory of Modern Facility Agriculture Technology and Equipment, Nanjing 210031, China
*
Author to whom correspondence should be addressed.
Sensors 2020, 20(19), 5484; https://doi.org/10.3390/s20195484
Submission received: 16 August 2020 / Revised: 15 September 2020 / Accepted: 17 September 2020 / Published: 25 September 2020
(This article belongs to the Collection Advances in Spectroscopy and Spectral Imaging)

Abstract

:
Scattering hyperspectral technology is a nondestructive testing method with many advantages. Here, we propose a method to improve the accuracy of egg freshness, research the influence of incident angles of light source on the accuracy, and explain its mechanism. A variety of weak classifiers classify eggs based on the spectra after preprocessing and feature wavelength extraction to obtain three classifiers with the highest accuracy. The three classifiers are used as metamodels of stacking ensemble learning to improve the highest accuracy from 96.25% to 100%. Moreover, the highest accuracy of scattering, reflection, transmission, and mixed hyperspectral of eggs are 100.00%, 88.75%, 95.00%, and 96.25%, respectively, indicating that the scattering hyperspectral for egg freshness detection is better than that of the others. In addition, the accuracy is inversely proportional to the angle of incidence, i.e., the smaller the incident angle, the camera collects a larger proportion of scattering light, which contains more biochemical parameters of an egg than that of reflection and transmission. These results are very important for improving the accuracy of non-destructive testing and for selecting the incident angle of a light source, and they have potential applications for online non-destructive testing.

1. Introduction

The freshness of eggs is related to their nutritional value. It is the most concerned index of processing companies and consumers, and an important index in transportation and processing [1]. It can be detected using traditional biochemical methods, but they are destructive, time-consuming, and inefficient. Therefore, non-destructive testing technology has significant advantages in the detection of egg freshness and has attracted wide attention. Currently, egg freshness is tested using non-destructive techniques of spectral analysis [2,3], dielectric property [4,5], electronic nose [6,7], machine vision [8,9], and hyperspectral testing [10,11,12]. Especially, machine vision method was established for egg freshness with an R (correlation coefficient) value of 0.8653 [8]. The prediction model was established using near-infrared spectroscopy with an R value of 0.879 [13]. The freshness model was established by testing the volatile concentration of eggs by electronic nose with a low efficiency, thus, it is not suitable for the dynamic testing of production line [7]. The egg freshness was tested using reflectance near-infrared hyperspectral with an R value of 0.879 [10], which could achieve rapid and non-destructive classification of egg freshness. However, the model precision could not be further improved due to the great influence of eggshell colors.
Hyperspectral imaging technology is an emerging non-destructive testing technology that can obtain a large number of spatial image information samples of the frequency band and the spectral information of each pixel [14]. Currently, hyperspectral technology can be applied to non-destructive testing of the phenotype of grains, fruits, and vegetables [15,16,17]. However, there are only a few papers using it to study the freshness of eggs. Among them, using reflectance hyperspectrum to detect egg freshness can achieve fast and non-destructive grading of egg freshness with a correlation coefficient of 0.93 [18]. In addition, by using the optimal classification model (IRIV GA-SVM), the classification accuracy on the training set and test set achieved 99.25% and 97.87% respectively [19]. However, there are few studies on the non-destructive freshness detection of scattering and transmission hyperspectral. Meanwhile, the optical fiber scattering spectra have been used to study the surface and internal defects of apples and tomatoes with high accuracy [20], which indicated that it would be feasible to detect the freshness of eggs.
Herein, we proposed a method to improve the accuracy of egg freshness based on hyperspectral scattering imaging, and we researched the influence of incident angles on the accuracy and explained its mechanism. We found that stacking ensemble learning could be used to improve the highest accuracy of egg freshness, and the accuracy is inversely proportional to the incident angle. These results are useful for improving the accuracy of a classifier, important for selecting the incident angle of a light source with high accuracy, and they have potential applications in online non-destructive testing.

2. Materials and Methods

2.1. Experimental Materials

A total of 350 eggs (pink shell, mass 31.5–46.6 g, equatorial diameter 32.8–41.9 mm) were purchased from Panchu Mechanized Chicken Farm, Nanjing, Jiangsu Province, China. They were all produced on the day of purchase and stored at room temperature after cleaning. These eggs were divided into two groups, i.e., the data group and the calibration group, with 200 and 150 eggs, respectively. The data group was used to collect hyperspectral images, and the calibration group was used to measure the Haugh unit.

2.2. Hyperspectral Imaging System

The hyperspectral instrument was a GaiaSorter-Dual “Gaia” dual-camera all-band hyperspectral sorter. Its main components include a uniform light source, a dual spectrum camera, an electronic control transfer module, a computer with a control software, etc. The dual spectrum camera included two hyperspectral cameras, Camera 1 (Image-λ-V10E, wavelength range 391.6–1044.1 nm, and resolution 2.5 nm) and Camera 2 (Image-λ-N25E, wavelength range 1044.1–2528.1 nm, and resolution 5.6 nm).
The reflection images of eggs were collected using the reflection hyperspectral imaging system (Figure 1). The light source of this system is a dome uniform light source with a wavelength range of 50–2500 nm. The light source uniformly irradiates the egg on the electronically controlled moving platform. The reflected light of the egg is captured by the hyperspectral camera through the lens to obtain one-dimensional images and spectra. When the platform drives the egg to run continuously, continuous one-dimensional images and real-time spectra can be obtained. Note that the spectra are automatically recorded by the computer software. Finally, we obtained a three-dimensional data cube containing reflection image and spectral information.
The scattering, transmission, and mixed hyperspectral images of eggs were collected using an optical fiber hyperspectral imaging system (Figure 2). The light source of the system was an optical fiber halogen lamp (LG-150B, wavelength range 400–2500 nm). The incident angle of the fiber could be adjusted to collect the corresponding types of hyperspectral images. The scattering hyperspectral images were collected as the incident angle was 0°. The mixed hyperspectral images were collected as the incident angles were 10°, 20°, 30°, 40°, 50°, and 60°, respectively. The transmission hyperspectral images were collected as the light of fiber was shot directly under the egg. As the angle was selected, the platform drove the sample to move continuously to obtain continuous one-dimensional images and real-time spectral information. Finally, we obtained a three-dimensional data cube including scattering, transmission, and mixed images and spectral information.

2.3. Data Acquisition and Correction

The equipment was prepared before testing. The detection system was warmed up for 30 min. The height of “Camera 1” was set to 10 cm, the exposure time was 7 ms by adjustment and comparison. The height of “Camera 2” was set to 25 cm, and the exposure time was 9 ms. The conveyor belt speed was 0.36 cm/sec. The hyperspectral images were collected as follows: Ten eggs were randomly selected from the data group every day, and the larger end of the eggs (with air chamber) was placed upward under the dome uniform light source to obtain the reflection hyperspectral images. Then, they were placed in the transmission light and the optical fiber light sources with incident angles of 0°, 10°, 20°, 30°, 40°, 50°, and 60° to obtain the scattering, transmission, and mixed hyperspectral of the eggs. The tests were repeated and lasted for 28 days. The collected hyperspectral images were corrected in black and white because of the influence of dark current or uneven illumination on the experiment [21]. It was corrected by using SpecVIEW software established in the system and Equation (1) as follows:
R = I 0 I b I w I b
where R is the corrected spectral image, I 0 is the original spectral image, I w is the total reflection image of polyfluortetraethylene plate, I b is the all-black image by coving the lens.

2.4. Automatic ROI Extraction

Step 1 ROI mask
The images (R, 650; G, 550; B, 450) were exported by the software ENVI 4.8. The images were extracted by using MATLAB. They were binarized, and then operated by threshold segmentation, expansion, and erosion. Subsequently, their centroids were extracted and marked. We used threshold segmentation to extract regions with the color similar to eggshells. The regions contained only a small amount of glare. According to the selected area, the maximum horizontal and vertical lengths were calculated as the long axis and short axis of the ellipse. Finally, the center of the ellipse was used as the center of the original image, and the parameters of the long axis and the short axis were combined to fit and expand the ellipse image. Then, we extracted the ROI (region-of-interest) mask by the selected ellipse.
Step 2 Automatically extract the ROI of spectra
The positions of eggs in the mask image were extracted using the cell counting algorithm. The corresponding ROIs of eggs were determined and numbered by the settings of their mask images. These images were imported into ENVI. The average spectrum of a single ROI was used as the spectrum of an egg. The detailed processes are shown in Figure 3.

2.5. Determination of Haugh Unit

Five eggs were randomly selected from the calibration group every day, and they were numbered and weighed. For each egg, the shell were broken gently, and the height of protein was measured at 3 different points of 1 cm from the edge of their yolks. Three points were selected as far as possible, and the average height was used as the protein height of an egg. The Haugh units of the 5 eggs were calculated by Equation (2), and their average value was used as the egg freshness of the day [22] as follows:
H U = 100 × l g ( h + 7.57 1.7 w 0.37 )
where H U is Haugh unit of an egg, h (mm) is the average protein height of the three points; w (g) is the weight of an egg.

2.6. Spectrum Processing Method

It was necessary to preprocess the original spectra due to the uneven intensity of light sources at different wavelengths and the influence of instrument noise. In this paper, the spectra were processed using ten preprocessing methods, including multiplicative scatter correction (MSC) [23], standardized normal variate (SNV) [24], normalization [25], autoscales [26], mean centering (MC) [27], moving average method (MA) [28], detrend fluctuation analysis (Detrend) [29], Savitsky–Golay smoothing (SG) [30], Savitsky–Golay first derivative (SG-FD) [31], and Savitsky–Golay second derivative (SG-SD) [32]. To reduce calculation and increase calculation speed, competitive adaptive reweighted sampling (CARS) [33], principal components analysis (PCA) [34], and successive projections algorithm (SPA) [35] are preferable to extract feature wavelengths to reduce the dimensionality. The preprocessed dataset was used to extract feature wavelengths and used as the final sample. Then, 71.43% of the samples were randomly selected as the training set, and the remaining 28.57% 0% as the test set. We compared the prediction of egg freshness using the following six models: support vector machine (SVM) [36], k-nearest neighbor (KNN) [37], random forest (RF) [38], Naive Bayes (NB) [39], discriminant analysis classifier (DAC) [40], and latent Dirichlet allocation (LDA) [41]. In order to further improve the accuracy and the generalization ability of the egg freshness classification model, multiple weak classifiers were merged into a strong classifier by stacking ensemble learning [42].

3. Guided Filtering

3.1. Determination of Egg Haugh Unit

Five eggs were selected randomly every day to measure their Haugh units, and the units of 140 eggs were measured within 28 days. The units decrease linearly with time (Figure 4), and they fit well with Equation (3). Their detailed distribution is shown in Table 1.
y = 85.70 1.75 x
It shows that the Haugh units range from 33.4 to 84.5, thus these eggs are edible. Their units are 84.5–72, 70.5–61.5, 59.8–49.0, and 47.2–33.4 in the first, second, third, and fourth weeks, and their freshness are classified as Grade AA, A, B1, and B2, respectively. After the fourth week, their units are below 30 and classified as Grade C, because their Haugh units gradually decrease. These eggs are easy to distinguish due to their obvious spoilage and unpleasant smell deterioration, therefore, they will not be discussed in this article.

3.2. Spectral Preprocessing

The original spectra contain a lot of information about the freshness of an egg, however, it is impossible to find the law directly (Figure 5a,d,g,j). The spectra have obvious noise, which interferes with the later extraction of feature wavelength and modeling, and therefore reduces the accuracy of the prediction model. Therefore, the original spectra should be preprocessed separately. SG is an algorithm of polynomial smoothing and weighted average of moving windows based on the principle of least squares, whereas the main idea of FD is to obtain the first derivative of the spectrum, thereby amplifying the differences among different spectra. Herein, the original spectra are treated using SG-FD (Figure 5b,e,h,k). We obtain the average of the four Grade AA, A, B1, and B2, after the SG-FD treatment (Figure 5c,f,I,l). The obvious difference in spectra are mainly distributed in the 400–600, 550–800, 550–800, and 400–1000 nm in uniform reflection, transmission, 0° scattering, and 40° mixed spectra, respectively. This indicates that the difference in light source result in the egg information differences detected by hyperspectral images.

3.3. Feature Wavelength Extraction and Model Establishment

In our experiment, we use PCA, CARS, and SPA to extract the feature wavelengths and reduce the redundancy of the full-band original spectra, which eliminates irrelevant information, optimizes effective information, and establishes low-dimensional data models. Finally, different classification models are established according to the feature wavelength, and the best model is obtained by comparative analysis.

3.3.1. Model Based on PCA

The PCA analysis was based on preprocessed data. We performed a certain standardization and MC preprocess on the data before PCA. Figure 6a–d shows the PCA analysis results (PC1-PC2, PC1-PC3) in the case of 0° fiber light source based on SG preprocessing.
The contribution rate of the first, second, and third principal component are 97.8%, 1.6%, and 0.4%, respectively. The total contribution of these three components contains 99.79% of the spectral information, indicating that the feature wavelength can be reliably decomposed from the three components. Figure 6a,b shows the score plot of the AA, A, B1, and B2 levels of eggs, indicating that the A and AA levels of eggs are easily separated from the B1 and B2 levels in the principal component space. However, there are large overlaps between A and AA levels, B1 and B2 levels, and therefore it is difficult to distinguish them, i.e., we can easily distinguish the freshness and staleness of eggs based on PCA, but it is difficult to distinguish the more detailed level of freshness. Therefore, the accuracy of PCA may not be suitable for subsequent modeling. Figure 6c,d is the loading plot of the PCA model, which explains the contribution of each spectral value to the model establishment. The greater the coefficient of the spectral value, the greater the contribution rate to the model. The feature wavelength can be decomposed by searching the values with large coefficients to reduce the data dimension.
We take the various preprocessing methods of scattering hyperspectral at the 0° incident light as an example, calculate the cumulative contribution of the first 20 principal components (Figure 7). It shows that the first three principal components have the highest contribution. They were selected as feature component to extract the feature wavelengths.
Meanwhile, the cumulative contribution rates of different pretreatments are shown in Table 2. It can be seen that the cumulative contribution of the first three components for normalization, MC, MA, detrend, and SG are above 90%, which indicates that the feature wavelength can be reliably decomposed from the three components. Therefore, the first three components of these pretreatments are selected as the new coordinate system to reduce the dimension of the original spectra and extract the feature wavelengths.
Then, we establish LIBSVM, DCA, LDA, KNN, RF, and NB models to calculate the accuracy of training set and test set, respectively (Table 3). The results show that the overall accuracy is not high by using the weak classifier based on PCA. Among them, the classification accuracy of KNN and NB modeling is only 83.75%. The pretreatment of SG and MC have the best accuracy.

3.3.2. Model Based on Successive Projections Algorithm (SPA)

The successive projections algorithm (SPA) can eliminate collinear redundancy to find the wavelength segment with the minimum collinear information and represent the maximum information of the sample. In this experiment, the number of wavelengths selected by SPA was set to range from 5 to 30, and the step length was 1. Then, we iterated the data and selected the wavelength with the largest projection phasor as the feature wavelength combination. Meanwhile, the RMSE of different combinations was calculated by linear regression until the feature wavelength combination corresponding to the minimum RMSE was obtained. The SPA feature wavelength was extracted from the preprocessed data of SG-FD as the incident angle of 0°. The results show that the best RMSE = 0.58 as the feature wavelength is 22 (Figure 8).
The number of feature wavelength was extracted differently using different preprocessing methods (Table 4). Subsequently, LIBSVM, DCA, LDA, KNN, RF, and NB models were established to obtain the accuracy of the training set and the test set (Table 5).
By comparing Table 3 and Table 5, it can be concluded that the accuracy of feature wavelength extraction based on SPA is generally higher than that of PCA. In addition, the pretreatment of MSC, SNV, auto, and MC classified using the DAC model has higher accuracy; the 0° incidence angle MSC-SPA-DAC has the highest accuracy of 96.25%, while that of reflection incidence SG-SPA-LDA is 81.25%. These results are consistent in that the light of scattering has more internal information of an egg than that of reflection.

3.3.3. Model Based on Competitive Adaptive Reweighted Sampling (CARS)

Competitive adaptive reweighted sampling (CARS) is based on the principle of “survival of the fittest” in Darwin’s theory of evolution. In order to reduce the dimensionality, partial least squares are used to select the spectral value with a larger regression coefficient, and the value with a smaller one is eliminated to select some feature wavelengths for representing the full spectral information. After this preprocessing, the dimensionality of the data is effectively reduced. In this study, we reduced the dimensionality of the preprocessed spectrum by CARS and sampled the eggs by using Monte Carlo. The sampling time of Monte Carlo was set to 100, and the PLS model was established by using five-fold cross validation. Subsequently, the 0° incident light was taken as an example to extract the process of the feature wavelengths after SG-FD preprocessing (Figure 9).
The number of retained wavelengths decreases slowly after starting to decrease rapidly as the sampling frequency increases. RMSECV decreases slowly as the number of sampling runs ranges from 0 to 24, indicating that the eliminated wavelength has little influence on RMSECV. However, it increases significantly as the number exceeds 24, indicating that the feature wavelengths have been deleted. Therefore, the number of extracted feature wavelengths is 24. Similarly, the number preprocessed by other methods can be extracted (Table 6). Subsequently, the egg freshness classification models are established by LIBSVM, DCA, LDA, KNN, RF, and NB (Table 7).
It can be seen that the accuracy of weak classifier modeling based on CARS feature wavelength extraction is generally higher than that of SPA and PCA for egg freshness. The CARS classifier has a large number of models with high accuracies. Among them, DAC and KNN models have the highest accuracies. The models of 0° incident light SNV/Auto/SG-CARS-DAC, 0° incident light SNV-CARS-KNN, 40° incident light MSC-CARS-DAC/KNN, and 40° incident light detrend-CARS-RF have the highest accuracies of 95%. These indicate that the model corresponding to the 0° fiber light source has the highest accuracy and that of 40° fiber light source has the higher accuracy. Meanwhile, the model with uniform reflection light source has the lowest accuracy.

3.4. Best Prediction Model of Egg Freshness

The method presented in Section 3.3 is used for the nine different incident light modes to select their highest accuracy of egg freshness, respectively (Table 8). It shows that the overall model accuracy is extracted by the feature wavelength of CARS, which is higher than PCA and SPA. Among them, the weak classifiers DAC, KNN, and PCA have the three highest accuracies. Moreover, the accuracy of the MSC-SPA-DAC model (96.25) is the highest as the incident light angle is 0°. The accuracies of the 30° incident light using MA-CARS-KNN model and the 40° incident light using MSC-CARS-DAC model are 95% and 95%, respectively. These models with mean reflection light and 60° incident light have low accuracy, 86.25% and 87.5%, respectively. This indicates that the accuracy of the scattering hyperspectral model is higher than the other three models. In addition, as the angle of incidence increases, the overall accuracy decreases.

3.5. Egg Freshness Classification Based on Stacking Ensemble Learning

To further improve the accuracy of the model, several weak classifiers are combined into a strong classifier, and stacking ensemble learning (SEL) [32] is performed to improve the generalization ability of the classification model. A two-layer training structure of SEL is used to improve the accuracy and speed of model. The overall flow chart of stacking ensemble learning is shown in Figure 10. The first layer uses different classifiers to establish different meta-classifiers and integrates the prediction results of all meta-classifiers. Then, the integrated data set of the classifiers with high accuracy in the first layer is used as the input of the second layer. Finally, the second layer is trained with the best classifier.
Therefore, in this experiment, three classifiers with the best model accuracy are selected to establish three meta-classifiers as the input of the second layer. The training and test set are predicted based on the idea of five-fold cross validation in each meta-classifier, in order to prevent data leakage (Figure 11). Finally, the new training and test set are used to establish the egg freshness classification model based on SEL.
The three classifiers, DAC, KNN, and RF, with the best accuracy are selected as the first layer. Meanwhile, the DAC model with the highest accuracy is selected as the second layer. Table 9 shows the results of the uniform reflection light source and transmission, 0° and 40° incident light sources.
It can be seen that the model based on SPA and CARS for extracting feature wavelength can finally achieve a higher accuracy than that of PCA. We compare the accuracies of different incident light corresponding models and find that the model of 0° fiber incident light source has the highest accuracy. Specifically, the 0° incident light source based on MSC-SPA can be increased from 96.25% to 100% (Table 10). That of the 40° fiber incident light source is higher. The accuracy of its SG/MSC-CARS-stacking and detrend-SPA-stacking models can reach 96.25%. While, that of uniformly reflected light source has the lowest accuracy, which is only 88.75% of its detrend-CARS-stacking model.
The highest accuracy of the best model is different under different incident angles (Figure 12). The accuracy at the 0° incident light (100%) is the highest. Its accuracy is almost linearly reduced from 100% to 90% as the incident angle increases from 0° to 60°. The accuracy of the transmission and reflection incident model are 92.5% and 87.5%, respectively. These indicate that the incident angle has an important influence on the accuracy of a model.

4. Discussion

The accuracy of the non-destructive detection model for egg freshness based on hyperspectral can be improved by using stacking ensemble learning. The learning is to use the output results of a series of models (base model) as the input features of the other models. This method realizes the stacking of models, that is, the outputs of the first layer model are used as the inputs of the second layer model. In operation, we need to pay attention to no leakage when combining the output of the first layer model. In addition, the data used for the output results of the basic model in the training samples cannot be used for training, in order to prevent overfitting of the final prediction. Note that validation on the training set is better than that on the test set. In order to prevent data leakage, it is necessary to output the results of each part of the sample separately by the k-fold method. In our experiment, we use the five-fold method (Figure 10) as follows: (1) We divide the data into five parts. One part at a time is used as the validation set, and the remaining four parts are used as the training set. In this way, a total of five models can be trained. (2) For the training set, one model is trained at a time to predict the validation set, and the prediction results are used as the second layer input of the corresponding samples in the validation set. The process is repeated five times, and obtain the outputs of each training sample that could be used as the input of the second layer model. (3) For the test set, one model is trained at a time to predict a result. Therefore, the sample in the final test set has five output results, and the average of these results is used as the input for the second layer. Therefore, in our experiment, the following six machine learning algorithms, LIBSVM, DCA, LDA, KNN, RF, and NB, are used to find the best combination of base-classifiers in the first stage and meta-classifier in the second stage. The three highest accurate classifiers, i.e., DAC, KNN, and RF, are used as the first layer. The training and test set are predicted based on the idea of five-fold cross validation in each metamodel to prevent data leakage (Figure 10). Finally, we obtain the first layer of data input into the second layer of the DAC model, and this method has the highest accuracy.
Different incident angles cause different information to be contained in the light collected by the camera, resulting in different accuracy of egg freshness. The freshness is closely related to the internal composition of an egg, yolk index [43], the pH of protein [1], and air chamber index [44]. The spectra collected about the more internal information of an egg is the precondition for establishing a model with higher accuracy. The analysis of the light propagation paths inside an egg helps us to understand the information contained in the image at different incident angles. For different incident modes, the propagation paths of light through an egg are different, and therefore the information collected is also different (Figure 13).
The camera mainly captures the reflected light of an egg as the incident light is a dome uniform light source, captures the scattered light through an egg as the incident angle is 0°, captures the reflection and the scattered light as the incident angle ranging from 0° and 60°, and captures the transmission light as the transmission fiber light. The scattered light through an egg carries out a lot of the biochemical information of the egg yolk, egg white, and air chamber. The reflected light by an egg only contains the information of the eggshell. The transmission light through an egg also carries out a lot of information, and the camera collects a higher proportion of the original light from the incident light source, resulting in a low accuracy. In our experiment, a camera captures a larger proportion of scattered light and a smaller proportion of reflection light as the incident angle is 0°, the accuracy of this angle is the highest. Meanwhile, the proportion of scattered light decreases and that of the reflection light increases as the incident angle increases gradually from 0° to 60°, causing the accuracy to decease gradually with an increase of the incident angle. The proportion of the reflection light should be the highest as the angle increases to 90°, thus its corresponding accuracy should be the lowest. In this mode, most of the light is reflected by the eggshell and captured by a camera. A small part of the light passes through the eggshell to enter the inside of the egg, but a larger proportion of the light shoots out from the bottom of the egg, which cannot be detected by the camera on the top of the egg. Therefore, only a very small part of the light is scattered on the upper of the egg and captured by the camera, resulting in its low accuracy. However, the 90° incident angle could not be tested due to the location conflict of the camera and the incident light source. However, the dome uniform light source is the light source with a weak intensity, which cannot nearly penetrate the eggshell, and only reflection light is captured by the camera. Thus, it is very similar to the 90° incident angle of the fiber light source. This is the reason why the accuracy of the model decreases linearly as the angle increases from 0° to 60° and R. (Table 10). For the transmitted light source, most of the light is reflected from the bottom of the egg, the scattered light from the lower layer of the egg is absorbed by the yolk, and only a small part of the scattered light from the upper layer is captured by the camera, and a large amount of the original light also interferes with the test accuracy. Hence, its detection accuracy is not high.

5. Conclusions

This paper has studied a method for improving the accuracy of egg freshness based on scattering hyperspectral, as well as researched the influence of different incident angles on the accuracy and explained its mechanism. The data processing process and conclusions are the following; (a) We established the classification model of egg freshness based on the combination of different preprocessing, feature wavelength extraction, and weak classifiers, and obtained the best classification models. We found that the 0° fiber light source MSC-SPA-DAC had the highest accuracy of 96.25%. Moreover, the detection accuracy of the 30° fiber light source MA-CARS-KNN and 40° fiber light source MSC-CARS-DAC were 95% and 95%, respectively. (b) Stacking ensemble learning was used to establish a fast egg freshness classification model to further improve the accuracy. In the 0° fiber optic light source MSC-SPA-stacking combination mode, the accuracy increased from 96.25% to 100%. (c) The hyperspectral classifier model of egg freshness was established under different incident light irradiation. Their highest accuracies of scattering, reflection, transmission, and mixed modes were 100.00%, 88.75, 95.00%, and 96.25%, respectively, indicating that the scattering hyperspectral for egg freshness detection was better than the other three. Moreover, the accuracy was inversely proportional to the incident angle, that is, the greater the incident angle, the lower the detection accuracy. Finally, this experiment realizes the non-destructive and high-precision detection of egg freshness based on scattering hyperspectral, and it has potential applications in online non-destructive detection.

Author Contributions

D.D. proposed the conceptualization, methodology, and wrote the paper; T.J. designed and carried out the experiments; W.L. improved the methodology and conceived the experiment; X.S. and R.X. programed the software; J.Z. compared the performance of the algorithms. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the National Natural Science Foundation of China (31960487 and 11604154), the Jiangsu Provincial Natural Science Foundation of China (BK20181315), and the Yangzhou Key R&D Program (Modern Agriculture) (YZ2018038).

Acknowledgments

The authors wish to thank the editor and reviewers for their suggestions.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Dong, X.; Dong, J.; Li, Y.; Xu, H.; Tang, X. Maintaining the predictive abilities of egg freshness models on new variety based on VIS-NIR spectroscopy technique. Comput. Electron. Agric. 2019, 156, 669–676. [Google Scholar] [CrossRef]
  2. Liu, Y.; Ren, X.; Yu, H.; Cheng, Y.; Guo, Y.; Yao, W.; Xie, Y. Non-destructive and online egg freshness assessment from the egg shell based on Roman spectroscopy. Food Control 2020, 118, 107426. [Google Scholar] [CrossRef]
  3. Joshi, R.; Lohumi, S.; Joshi, R.; Kim, M.S.; Qin, J.; Baek, I.; Cho, B. Raman spectral analysis for non-invasive detection of external and internal parameters of fake eggs. Sens. Actuators B Chem. 2019, 303, 127243. [Google Scholar] [CrossRef]
  4. Lau, S.; Subbiah, J. An automatic system for measuring dielectric properties of foods: Albumen, yolk, and shell of fresh eggs. J. Food Eng. 2018, 223, 79–90. [Google Scholar] [CrossRef]
  5. Sun, J.; Liu, B.; Mao, H.; Wu, X.; Gao, H.; Yang, N. Non-destructive examination for freshness of eggs based on dielectric properties and yolk index regression model. Trans. Chin. Soc. Agric. Eng. 2016, 32, 290–295. [Google Scholar]
  6. Xiang, X.; Wang, Y.; Yu, Z.; Ma, M.; Zhu, Z.; Jin, Y. Non-destructive characterization of egg odor and fertilization status by SPME/GC-MS coupled with electronic nose. J. Sci. Food Agric. 2019, 99, 3264–3275. [Google Scholar] [CrossRef]
  7. Yimenu, S.; Kim, J.; Kim, B. Prediction of egg freshness during storage using electronic nose. Poult. Sci. 2017, 96, 3733–3746. [Google Scholar] [CrossRef]
  8. Sun, L.; Yuan, L.; Cai, J.; Lin, H.; Zhao, J. Egg freshness on-line estimation using machine vision and dynamic weighing. Food Anal. Methods 2014, 8, 922–928. [Google Scholar] [CrossRef]
  9. Guanjun, B.; Mimi, J.; Yi, X.; Shibo, C.; Qinghua, Y. Cracked egg recognition based on machine vision. Comput. Electron. Agric. 2019, 158, 159–166. [Google Scholar] [CrossRef]
  10. Suktanarak, S.; Teerachaichayut, S. Non-destructive quality assessment of hens’ eggs using hyperspectral images. J. Food Eng. 2017, 215, 97–103. [Google Scholar] [CrossRef]
  11. Siche, R.; Vejarano, R.; Aredo, V.; Velasquez, L.; Saldaña, E.; Quevedo, R. Evaluation of food quality and safety with hyperspectral imaging (HSI). Food Eng. Rev. 2015, 8, 306–322. [Google Scholar] [CrossRef]
  12. Zhang, W.; Pan, L.; Tu, S.; Zhan, G.; Tu, K. Non-destructive internal quality assessment of eggs using a synthesis of hyperspectral imaging and multivariate analysis. J. Food Eng. 2015, 157, 41–48. [Google Scholar] [CrossRef]
  13. Lin, H.; Zhao, J.; Sun, L.; Chen, Q.; Zhou, F. Freshness measurement of eggs using near infrared (NIR) spectroscopy and multivariate data analysis. Innov. Food Sci. Emerg. Technol. 2012, 12, 182–186. [Google Scholar] [CrossRef]
  14. Sunli, C.; Jun, S.; Hanping, M.; Xiaohong, W.; Pei, W.; Xiaodong, Z. Non-destructive detection for mold colonies in rice based on hyperspectra and GWO-SVR. J. Sci. Food Agric. 2018, 98, 1453–1459. [Google Scholar] [CrossRef] [PubMed]
  15. Herzig, P.; Backhaus, A.; Seiffert, U.; von Wirén, N.; Pillen, K.; Maurer, A. Genetic dissection of grain elements predicted by hyperspectral imaging associated with yield-related traits in a wild barley NAM population. Plant Sci. 2019, 285, 151–154. [Google Scholar] [CrossRef] [PubMed]
  16. Steinbrener, J.; Posch, K.; Leitner, R. Hyperspectral fruit and vegetable classification using convolutional neural networks. Comput. Electron. Agric. 2019, 162, 364–372. [Google Scholar] [CrossRef]
  17. Zhang, C.; Wang, Q.; Liu, F.; He, Y.; Xiao, Y. Rapid and non-destructive measurement of spinach pigments content during storage using hyperspectral imaging with chemometrics. Measurement 2017, 97, 149–155. [Google Scholar] [CrossRef]
  18. Wang, Q.; Zhou, K.; Wu, L.; Wang, C. Egg freshness detection based on hyper-spectra. Spectrosc. Spectr. Anal. 2016, 36, 2596–2600. [Google Scholar]
  19. Yao, K.; Sun, J.; Zhou, X.; Nirere, A.; Tian, Y.; Wu, X. Nondestructive detection for egg freshness grade based on hyperspectral imaging technology. J. Food Process. Eng. 2020, 43, e13422. [Google Scholar] [CrossRef]
  20. Lu, Y.; Huang, Y.; Lu, R. Innovative hyperspectral imaging-based techniques for quality evaluation of fruits and vegetables: A review. Appl. Sci. 2017, 7, 189. [Google Scholar] [CrossRef]
  21. Qiu, Y.; Wu, G.; Xiao, Z.; Guo, Y.; Zhang, X.; Liu, K. An extreme-learning-machine-based hyperspectral detection method of insulator pollution degree. IEEE Access 2019, 7, 121156–121164. [Google Scholar] [CrossRef]
  22. Eisen, E.; Bohren, B.; McKean, H. The Haugh unit as a measure of egg albumen quality. Poult. Sci. 1962, 41, 1461–1468. [Google Scholar] [CrossRef]
  23. Zhao, J.; Fang, Y.; Chu, G.; Yan, H.; Hu, L.; Huang, L. Identification of leaf-scale wheat powdery mildew (Blumeria graminis f. sp. Tritici) combining hyperspectral imaging and an SVM classifier. Plants 2020, 9, 936. [Google Scholar] [CrossRef] [PubMed]
  24. Nelson, G.; Lines, A.; Bello, J.; Bryan, S. Online monitoring of solutions within microfluidic chips: Simultaneous Raman and UV-vis absorption spectroscopies. ACS Sens. 2019, 4, 2288–2295. [Google Scholar] [CrossRef] [PubMed]
  25. Du, T.; Wen, G.; Cai, Z.; Zheng, W.; Tan, M.; Li, Y. Spectral clustering algorithm combining local covariance matrix with normalization. Neural Comput. Appl. 2018, 32, 6611–6618. [Google Scholar] [CrossRef]
  26. Lohumi, S.; Lee, H.; Kim, M.; Qin, J.; Cho, B. Raman hyperspectral imaging and spectral similarity analysis for quantitative detection of multiple adulterants in wheat flour. Biosyst. Eng. 2019, 181, 103–113. [Google Scholar] [CrossRef]
  27. Amodio, M.; Capotorto, I.; Chaudhry, M.; Colelli, G. The use of hyperspectral imaging to predict the distribution of internal constituents and to classify edible fennel heads based on the harvest time. Comput. Electron. Agric. 2017, 134, 1–10. [Google Scholar] [CrossRef]
  28. Qiu, X.; Jia, X.; Zhao, H.; Zhang, C. Antinoise estimation of temperature and emissivity for FTIR spectrometer data using spectral polishing filters: Design and comparison. IEEE Trans. Geosci. Remote Sens. 2020, 1–17. [Google Scholar] [CrossRef]
  29. Benes, E.; Fodor, M.; Kovács, S.; Gere, A. Application of detrended fluctuation analysis and yield stability index to evaluate near infrared spectra of green and roasted coffee samples. Processes 2020, 8, 913. [Google Scholar] [CrossRef]
  30. Weng, H.; Lv, J.; Cen, H.; He, M.; Zeng, Y.; Hua, S.; He, Y. Hyperspectral reflectance imaging combined with carbohydrate metabolism analysis for diagnosis of citrus Huanglongbing in different seasons and cultivars. Sens. Actuators B Chem. 2018, 275, 50–60. [Google Scholar] [CrossRef]
  31. Hong, Y.; Liu, Y.; Chen, Y.; Liu, Y.; Yu, L.; Liu, Y.; Cheng, H. Application of fractional-order derivative in the quantitative estimation of soil organic matter content through visible and near-infrared spectroscopy. Geoderma 2019, 337, 758–769. [Google Scholar] [CrossRef]
  32. Li, Y.; Deng, L.; Yang, X.; Liu, Z.; Zhao, X.; Huang, F.; Zhu, S.; Chen, X.; Chen, Z.; Zhang, W. Early diagnosis of gastric cancer based on deep learning combined with the spectral-spatial classification method. Biomed. Opt. Express 2019, 10, 4999–5014. [Google Scholar] [CrossRef] [PubMed]
  33. Wu, N.; Jiang, H.; Bao, Y.; Zhang, C.; Zhang, J.; Song, W.; Liu, F. Practicability investigation of using near-infrared hyperspectral imaging to detect rice kernels infected with rice false smut in different conditions. Sens. Actuators B Chem. 2020, 308, 127696. [Google Scholar] [CrossRef]
  34. Medina, M.; Díaz, J.; Vignolo, C. Fractal dimension of sparkles in automotive metallic coatings by multispectral imaging measurements. ACS Appl. Mater. Interfaces 2014, 6, 11439–11447. [Google Scholar] [CrossRef] [PubMed]
  35. Goudarzi, N.; Goodarzi, M.; Araujo, M.; Galvão, R. QSPR modeling of soil sorption coefficients (KOC) of pesticides using SPA-ANN and SPA-MLR. J. Agric. Food Chem. 2009, 57, 7153–7158. [Google Scholar] [CrossRef]
  36. De Boves Harrington, P. Support vector machine classification trees. Anal. Chem. 2015, 87, 11065–11071. [Google Scholar] [CrossRef]
  37. Yan, S.; Yan, X. Using labeled autoencoder to supervise neural network combined with k-nearest neighbor for visual industrial process monitoring. Ind. Eng. Chem. Res. 2019, 58, 9952–9958. [Google Scholar] [CrossRef]
  38. Xing, J.; Luo, K.; Wang, H.; Jin, T.; Fan, J. Novel sensitivity study for biomass directional devolatilization by random forest models. Energy Fuels 2020, 34, 8414–8423. [Google Scholar] [CrossRef]
  39. Susič, N.; Žibrat, U.; Širca, S.; Strajnar, P.; Razinger, J.; Knapič, M.; Gerič Stare, B. Discrimination between abiotic and biotic drought stress in tomatoes using hyperspectral imaging. Sens. Actuators B Chem. 2018, 273, 842–852. [Google Scholar] [CrossRef] [Green Version]
  40. Sullivan, S.; Schmitt, P.; Muir, R.; DeWalt, E.; Simpson, G. Digital deconvolution filter derived from linear discriminant analysis and application for multiphoton fluorescence microscopy. Anal. Chem. 2014, 86, 3508–3516. [Google Scholar] [CrossRef]
  41. Xin, Z.; Jun, S.; Xiaohong, W.; Bing, L.; Ning, Y.; Chunxia, D. Research on moldy tea feature classification based on WKNN algorithm and NIR hyperspectral imaging. Spectrochim. Acta Part A Mol. Biomol. Spectrosc. 2019, 206, 378–383. [Google Scholar] [CrossRef] [PubMed]
  42. Li, J.; Yao, Y.; Xu, H.; Hao, L.; Deng, Z.; Rajakumar, K. SecReT6: A web-based resource for type VI secretion systems found in bacteria. Environ. Microbiol. 2015, 17, 2196–2202. [Google Scholar] [CrossRef] [PubMed]
  43. Wang, H.; Qiu, N.; Mine, Y.; Sun, H.; Meng, Y.; Li, B.; Keast, R. Quantitative comparative integrated proteomic and phosphoproteomic analysis of chicken egg yolk proteins under diverse storage temperatures. J. Agric. Food Chem. 2020, 68, 1057–1067. [Google Scholar] [CrossRef] [PubMed]
  44. Li, Y.; Li, W.; Hu, L.; Svanberg, K.; Svanberg, S. Non-intrusive studies of gas contents and gas diffusion in hen eggs. Biomed. Opt. Express 2019, 10, 83–91. [Google Scholar] [CrossRef]
Figure 1. Reflection hyperspectral imaging system. (1) Pink-shell egg; (2) Computer; (3) Black box; (4) Calibration whiteboard; (5) Sample table; (6) Dome uniform light source; (Camera 1) Visible near-infrared camera; (Camera 2) Short wave near-infrared camera.
Figure 1. Reflection hyperspectral imaging system. (1) Pink-shell egg; (2) Computer; (3) Black box; (4) Calibration whiteboard; (5) Sample table; (6) Dome uniform light source; (Camera 1) Visible near-infrared camera; (Camera 2) Short wave near-infrared camera.
Sensors 20 05484 g001
Figure 2. Optical fiber hyperspectral imaging system. (1) Pink-shell egg; (2) Computer; (3) Calibration whiteboard; (4) Optical fiber fixed metal frame; (5) Sample table; (6) Black box; (Camera 1) Visible near-infrared camera; (Camera 2) Short wave near-infrared camera.
Figure 2. Optical fiber hyperspectral imaging system. (1) Pink-shell egg; (2) Computer; (3) Calibration whiteboard; (4) Optical fiber fixed metal frame; (5) Sample table; (6) Black box; (Camera 1) Visible near-infrared camera; (Camera 2) Short wave near-infrared camera.
Sensors 20 05484 g002
Figure 3. Region-of-interest (ROI) extraction processes. (a) Reflection; (b) Transmission; (c) Mixed hyperspectra; (i) Centroid mark; (ii) ROI; (iii) Original hyperspectral.
Figure 3. Region-of-interest (ROI) extraction processes. (a) Reflection; (b) Transmission; (c) Mixed hyperspectra; (i) Centroid mark; (ii) ROI; (iii) Original hyperspectral.
Sensors 20 05484 g003aSensors 20 05484 g003b
Figure 4. Haugh units of eggs versus time.
Figure 4. Haugh units of eggs versus time.
Sensors 20 05484 g004
Figure 5. Savitsky–Golay first derivative (SG-FD) pretreatment. (a,d,g,j) The average hyperspectral of eggs per day from 1 to 28 days as incident light are reflection, transmission, 0° scattering, and 40° mixed spectra, respectively; (b,e,h,k) Corresponding spectra after SG-FD treatment; (c,f,i,l) The average spectra of Grade AA, A, B1, and B2 after SG-FD treatment, respectively.
Figure 5. Savitsky–Golay first derivative (SG-FD) pretreatment. (a,d,g,j) The average hyperspectral of eggs per day from 1 to 28 days as incident light are reflection, transmission, 0° scattering, and 40° mixed spectra, respectively; (b,e,h,k) Corresponding spectra after SG-FD treatment; (c,f,i,l) The average spectra of Grade AA, A, B1, and B2 after SG-FD treatment, respectively.
Sensors 20 05484 g005
Figure 6. Principal components analysis (PCA) of 0° fiber light source based on Savitsky–Golay smoothing (SG) preprocessing. (a) Score plot of PC1-PC2; (b) Score plot of PC1-PC3; (c) Loading plot of PC1-PC2; (d) Loading plot of PC1-PC3.
Figure 6. Principal components analysis (PCA) of 0° fiber light source based on Savitsky–Golay smoothing (SG) preprocessing. (a) Score plot of PC1-PC2; (b) Score plot of PC1-PC3; (c) Loading plot of PC1-PC2; (d) Loading plot of PC1-PC3.
Sensors 20 05484 g006
Figure 7. Cumulative contribution rates of the top 20 principal components in 0° incident light.
Figure 7. Cumulative contribution rates of the top 20 principal components in 0° incident light.
Sensors 20 05484 g007
Figure 8. Number of variables in the 0° incident light model. (a) RMSE polyline; (b) Selected variables.
Figure 8. Number of variables in the 0° incident light model. (a) RMSE polyline; (b) Selected variables.
Sensors 20 05484 g008
Figure 9. The extraction process of feature wavelength based on competitive adaptive reweighted sampling (CARS) at 0° incident source. (a) Number of sampling variables; (b) RMSECV; (c) Regression coefficient path.
Figure 9. The extraction process of feature wavelength based on competitive adaptive reweighted sampling (CARS) at 0° incident source. (a) Number of sampling variables; (b) RMSECV; (c) Regression coefficient path.
Sensors 20 05484 g009
Figure 10. General flowchart for stacking ensemble learning.
Figure 10. General flowchart for stacking ensemble learning.
Sensors 20 05484 g010
Figure 11. Training and prediction models for metamodels.
Figure 11. Training and prediction models for metamodels.
Sensors 20 05484 g011
Figure 12. Classification accuracy-incident light line chart.
Figure 12. Classification accuracy-incident light line chart.
Sensors 20 05484 g012
Figure 13. Light propagation inside an egg.
Figure 13. Light propagation inside an egg.
Sensors 20 05484 g013
Table 1. Distribution of egg Hastelloy.
Table 1. Distribution of egg Hastelloy.
FreshnessWeeksMaxMinAverageStandard Deviation
AA184.46372.73178.3164.198
A270.52761.54666.8933.602
B1359.82449.01954.4933.962
B2447.20233.40840.9915.492
Table 2. Cumulative contribution rates of the first three principal components.
Table 2. Cumulative contribution rates of the first three principal components.
Pretreatment MethodCumulative Contribution Rate/% (the First Three Principal Components)
ReflectionTransmission40°
MSC89.1694.9796.3195.64
SNV89.0196.8492.5088.63
Normalization95.5895.1195.9895.05
Auto89.0196.8492.5088.63
MC99.3190.7099.5199.15
MA99.3091.4999.5499.25
Detrend91.6398.9994.3890.89
SG99.3390.8799.4899.06
SG-FD79.7276.4486.7980.21
SG-SD80.2688.1571.1486.73
Table 3. The accuracy of the modeling based on PCA (the table shows the highest accuracy).
Table 3. The accuracy of the modeling based on PCA (the table shows the highest accuracy).
M.P.Training Set Prediction Accuracy/%Prediction Set Training Accuracy/%
R.T.40°R.T.40°
LibsvmSG608951.55147.581.2547.552.5
DACMC57.591.554.54943.7582.548.7546.25
LDASG726791.2583.563.756581.2560
KNNSG91.2586.258591.2583.7571.2572.558.75
RFMA9581.25858562.581.2552.548.75
NBSG62.573.59549.5606583.7547.5
M., model; P., pretreatment; R., reflection; T., transmission; 0°, 0° incident light; 40°, 40° incident light.
Table 4. Number of feature wavelengths extracted after successive projections algorithm (SPA) processing.
Table 4. Number of feature wavelengths extracted after successive projections algorithm (SPA) processing.
P.MSCSNVNorm.AutoMCMADetrendSGSG-FDSG-SD
R.17101610111912181612
T.2018171812152120126
22221622111819192215
40°35484726241626353544
N, number of feature wavelengths; P., pretreatment; R., reflection; T., transmission.
Table 5. The accuracy of the modeling based on SPA (the table shows the higher accuracies).
Table 5. The accuracy of the modeling based on SPA (the table shows the higher accuracies).
M.P.Training Set Prediction Accuracy/%Prediction Set Training Accuracy/%
R.T.40°R.T.40°
LibsvmSG-FD98.0094.5095.5096.5080.0075.0078.7578.75
DACMSC94.50100.00100.0099.0071.2591.2596.2585.00
SNV90.00100.00100.00100.0068.7590.0093.7592.50
Norm.87.0099.5099.0099.5062.5090.0091.2591.25
Auto90.00100.00100.00100.0068.7590.0093.7592.50
MA97.5099.0099.50100.0077.5081.2586.2591.25
Detrend95.0098.5099.0099.0077.5086.2585.091.25
SG98.0097.5099.0099.0077.5081.2585.0090.00
SG-FD97.0097.5098.0098.5077.5077.5092.5090.00
LDASG97.0075.0071.5094.0081.2560.0066.2578.75
KNNMSC10010098.7598.7578.7591.2576.2577.5
Auto10010010098.7586.2591.2591.2587.5
MC98.7598.7510010076.2587.576.2591.25
RFDetrend94.50100.00100.0099.0071.2591.2596.2585.00
SG90.00100.00100.00100.0068.7590.0093.7592.5
SG-FD87.0099.5099.0099.5062.5090.0091.2591.25
SG-SD90.00100.00100.00100.0068.7590.0093.7592.50
NBSNV97.5099.0099.50100.0077.5081.2586.2591.25
Norm.95.0098.5099.0099.0077.5086.2585.0091.25
MC97.0097.5098.0098.5077.5077.5092.5090.00
M., model; P., pretreatment; R., reflection; T., transmission; 0°, 0° incident light; 40°, 40° incident light.
Table 6. Number of feature wavelengths extracted after CARS processing.
Table 6. Number of feature wavelengths extracted after CARS processing.
P.MSCSNVNorm.AutoMCMADetrendSGSG-FDSG-SD
R16432632321446324046
T24352924202823272436
28442616161620222416
40°16241624162119201915
N, number of feature wavelengths; P., pretreatment; R., reflection; T., transmission.
Table 7. The accuracy of the modeling based on CARS (the table shows the higher accuracies).
Table 7. The accuracy of the modeling based on CARS (the table shows the higher accuracies).
M.P.Training Set Prediction Accuracy/%Prediction Set Training Accuracy/%
R.T.40°R.T.40°
LibsvmSG-SD98.0097.0098.50100.0080.0081.2590.0081.25
DACMSC94.0099.50100.00100.0073.7587.5091.2595.00
SNV98.00100.00100.00100.0081.2590.0095.0090.00
Norm.97.50100.00100.00100.0080.0092.5093.7588.75
Auto98.00100.00100.00100.0076.2591.2595.0088.75
MA98.0099.00100.0099.0078.7578.7593.7587.50
Detrend98.0099.5099.5099.5080.0088.7593.7593.75
SG98.0098.0099.50100.0078.7585.0095.0092.50
SG-FD98.0099.00100.0099.5082.5078.7592.5092.50
SG-SD98.0099.00100.00100.0078.7582.5092.5092.50
LDADetrend100.0078.5085.0092.5086.2566.2558.7578.75
KNNMSC100.00100.00100.00100.0073.7587.5091.2595.00
SNV100.00100.00100.00100.0081.2590.0095.0090.00
Norm.100.00100.00100.00100.0080.0092.5093.7588.75
Auto100.00100.00100.00100.0076.2591.2595.0088.75
MC100.00100.00100.00100.0080.0080.0086.2590.00
MA100.00100.00100.00100.0078.7578.7593.7587.50
RFDetrend94.0099.50100.00100.0073.7587.5091.2595.00
SG98.00100.00100.00100.0081.2590.0095.0090.00
SG-FD97.50100.00100.00100.0080.0092.5093.7588.75
SG-SD98.00100.00100.00100.0076.2591.2595.0088.75
NBSNV98.0099.00100.0099.0078.7578.7593.7587.50
Norm.98.0099.5099.5099.5080.0088.7593.7593.75
Auto98.0098.0099.50100.0078.7585.0095.0092.50
MC98.0099.00100.0099.5082.5078.7592.5092.50
MA98.0099.00100.00100.0078.7582.5092.5092.50
M., model; P., pretreatment; R., reflection; T., transmission; 0°, 0° incident light; 40°, 40° incident light.
Table 8. The highest accuracy of a model under different incident lights.
Table 8. The highest accuracy of a model under different incident lights.
Incident LightThe Best ModelAccuracy/%
Mean reflection lightDetrend-CARS-LDA86.25
Optical fiberTransmissionNomalization-CARS-DAC92.50
MSC-SPA-DAC96.25
10°MA-CARS-PCA93.75
20°SNV/Auto-SPA-DAC92.50
30°MA-CARS-KNN95.00
40°MSC-CARS-DAC95.00
50°Detrend/SG-CARS-DAC, Detrend-SPA-DAC91.25
60°SG-FD-SPA-KNN87.50
Table 9. The accuracies of the stacking ensemble learning model (the table shows the highest accuracy).
Table 9. The accuracies of the stacking ensemble learning model (the table shows the highest accuracy).
M.P.Training Set Prediction Accuracy/%Prediction Set Training Accuracy/%
R.T.40°R.T.40°
PCASG-SD100.0097.50100.0097.5081.2586.2582.5082.50
SPAMSC94.0099.50100.00100.0075.0093.75100.0090.00
SNV98.00100.00100.00100.0071.2591.2597.5095.00
Norm.97.50100.00100.00100.0077.5093.7597.5093.75
Auto98.00100.00100.00100.0072.5093.7595.0095.00
MA98.0099.00100.0099.0078.7583.7588.7595.00
Detrend100.0099.5099.5099.5082.5092.5088.7596.25
SG98.0098.0099.50100.0085.0083.7591.2592.50
SG-FD98.5099.00100.0099.5082.5078.7598.7592.50
CARSMSC94.50100.00100.0099.0080.0090.0095.0096.25
SNV90.00100.00100.00100.0087.5092.5097.5092.50
Norm.94.5099.5099.0099.5085.0095.0095.0092.50
Auto90.00100.00100.00 100.0085.0095.0098.7593.75
MA97.5099.0099.50100.0082.5081.2595.0090.00
Detrend95.0098.5099.0099.0088.7590.0097.5095.00
SG98.0097.5099.0099.0086.2587.5098.7596.25
SG-FD98.0097.5098.0098.5086.2583.7598.7595.00
SG-SD94.0087.0096.5096.5081.2586.2597.5093.75
M., model; P., pretreatment; R., reflection; T., transmission; 0°, 0° incident light; 40°, 40° incident light.
Table 10. The highest accuracy of the best model under different incident modes.
Table 10. The highest accuracy of the best model under different incident modes.
Incident LightThe Best ModelAccuracy/%
Mean reflection lightDetrend-CARS88.75
Optical fibertransmissionNormalization/auto-CARS95.00
MSC-SPA100.00
10°SG-CARS96.25
20°SNV-SPA, MSC-CARS95.00
30°MA-CARS96.25
40°SG/MSC-CARS, detrend-SPA96.25
50°SG-CARS, MA/detrend-CARS93.75
60°SG-FD-SPA90.00

Share and Cite

MDPI and ACS Style

Dai, D.; Jiang, T.; Lu, W.; Shen, X.; Xiu, R.; Zhang, J. Nondestructive Detection for Egg Freshness Based on Hyperspectral Scattering Image Combined with Ensemble Learning. Sensors 2020, 20, 5484. https://doi.org/10.3390/s20195484

AMA Style

Dai D, Jiang T, Lu W, Shen X, Xiu R, Zhang J. Nondestructive Detection for Egg Freshness Based on Hyperspectral Scattering Image Combined with Ensemble Learning. Sensors. 2020; 20(19):5484. https://doi.org/10.3390/s20195484

Chicago/Turabian Style

Dai, Dejian, Tao Jiang, Wei Lu, Xuan Shen, Rui Xiu, and Jingwei Zhang. 2020. "Nondestructive Detection for Egg Freshness Based on Hyperspectral Scattering Image Combined with Ensemble Learning" Sensors 20, no. 19: 5484. https://doi.org/10.3390/s20195484

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop