Application of near-infrared hyperspectral imaging to identify a variety of silage maize seeds and common maize seeds

Common maize seeds and silage maize seeds are similar in appearance and are difficult to identify with the naked eye. Four varieties of common maize seeds and four varieties of silage maize seeds were identified by near-infrared hyperspectral imaging (NIR-HSI) combined with chemometrics. The pixel-wise principal component analysis was used to distinguish the differences among different varieties of maize seeds. The object-wise spectra of each single seed sample were extracted to build classification models. Support vector machine (SVM) and radial basis function neural network (RBFNN) classification models were established using two different classification strategies. First, the maize seeds were directly classified into eight varieties with the prediction accuracy of the SVM model and RBFNN model over 86%. Second, the seeds of silage maize and common maize were firstly classified with the classification accuracy over 88%, then the seeds were classified into four varieties, respectively. The classification accuracy of silage maize seeds was over 98%, and the classification accuracy of common maize seeds was over 97%. The results showed that the varieties of common maize seeds and silage maize seeds could be classified by NIR-HSI combined with chemometrics, which provided an effective means to ensure the purity of maize seeds, especially to isolate common seeds and silage seeds.


Introduction
Maize is an important food crop in the world. It can be classied into common (edible) maize and silage maize according to their uses. Common maize is a main food source in our daily life. Common maize has different varieties, including sweet maize, waxy maize and so on. Different varieties have little difference in appearance, but there are differences in yield, quality, nutrition content, etc. 1 Silage maize can also be divided into different varieties according to the suitable growth environment, yield, and nutrient composition of the grain, etc. 2 Compared with common maize, silage maize has the characteristics of high biomass, good bre quality and good green retention, and is more suitable for animal consumption. [3][4][5] Variety purity is an important factor in evaluating seed purity. 6 Although common maize seeds and silage maize seeds have little difference in appearance, there are differences in internal composition. It is difficult to distinguish a mixture of common maize seeds and silage maize seeds. In the process of maize harvesting and marketing, different varieties of maize seeds are likely to be mixed and are difficult to be detected, which will have a certain impact on sellers and consumers. Strengthening the identication of maize seed purity is the key to ensure the purity of maize seeds. Identication of different varieties of common maize seeds and silage maize seeds is an important step to ensure the purity of maize seeds.
Traditional seed varieties' classication methods include manual inspection, protein electrophoresis, DNA molecular marker technique, etc. [7][8][9] Manual inspection is mainly based on the external shape (colour, shape, size, etc.) of seeds. It is difficult to classify seeds with similar external shape. 10 Protein electrophoresis technique is based on the content of protein in seeds of different varieties and the speed of protein molecules swimming in the electric eld to identify the variety of seeds. 11 It is accurate and effective, but requires professional operation. It is necessary to extract protein from seeds, which can damage the seeds, and is only suitable for the detection of small samples. For DNA molecular marker technique, a standard DNA ngerprint of seeds must be constructed rst. DNA is the main genetic material. It is very accurate and reliable for the classi-cation of the variety of seeds. However, this process requires more nancial and material resources, and the establishment of a complete DNA molecular marker identication system requires professional technicians and funds. 12 It is necessary to establish a rapid, non-destructive and convenient method to classify seed varieties.
With the development of technology, NIR and imaging technique have been applied in seed variety identication. The NIR spectral region is related to the combined frequency and doubled absorption of the vibration of hydrogen-containing groups (such as C-H, N-H and O-H) in organic molecules. Relevant research showed that the spectral reectance of seeds of different varieties were different, the detection process was fast and convenient, and it was necessary to combine chemometrics to classify seeds of different varieties. [13][14][15][16] Imaging technique has the advantages of nondestructive and convenient operation, and machine vision is widely used in seed variety identication. Through the analysis of colour, shape, texture and other information in the sample images obtained by machine vision technique, it was possible to identify the tiny features that were difficult to be distinguished by the naked eye. 17,18 However, machine vision only obtains the twodimensional spatial information of samples in visible bands, and the variety of seeds can be determined accurately with more information. Near-infrared hyperspectral imaging (NIR-HSI) is a fast non-destructive detection technique that integrates spectral technique and imaging technique. 19 NIR-HSI can simultaneously acquire NIR spectra (one-dimensional spectral information) and image information (two-dimensional spatial information). 20 Each pixel in a hyperspectral image has spectral information. The spectral information of each pixel combined with the corresponding spatial information can realize the visualization of sample features, which can intuitively show the differences among samples. NIR-HSI has been used to classify the variety of seeds. [21][22][23] For maize seeds, Williams et al. 24 used NIR-HSI to classify maize kernels of three hardness categories: hard, medium and so. Yang et al. 25 classied four varieties of waxy corn seeds. Sendin et al. 26 evaluated the application potential of NIR-HSI to grade whole white maize kernels. NIR-HSI could obtain comprehensive information. Compared with traditional methods, the accuracy of NIR-HSI still needed to be improved, but it had certain reliability. In addition, the simplicity of operation, the convenience of detection and nonpretreatment of samples were conducive to the further application of NIR-HSI in the classication of maize seed of different varieties. In fact, research of the classication of the variety of silage maize seed is relatively less. 9 Moreover, due to the similarity of appearance, silage maize seeds and common maize seeds are easy to be mixed together and difficult to be distinguished. Therefore, we attempted to classify common maize seeds and silage maize seeds by NIR-HSI.
The main purpose of this research was to explore the feasibility of using NIR-HSI to common and silage maize seeds of different varieties. The classication of eight varieties of maize seeds was studied, including four varieties of common maize seeds and four varieties of silage maize seeds. Support vector machine (SVM) and radial basis function neural network (RBFNN) classication models were established to classify the varieties of maize seeds. Considering the inuence of different varieties in maize seeds, the classication of common maize seeds and silage maize seeds was studied, and the classication of four varieties of common maize seeds and four varieties of silage maize seeds were studied respectively.
2.2 Hyperspectral imaging and spectral acquisition 2.2.1 Hyperspectral imaging system. The hyperspectral images of maize seeds were collected by using a hyperspectral imaging system established in the laboratory. The near-infrared spectral range was 874-1734 nm with 256 bands. The spectral resolution of the hyperspectral imaging system is 5 nm. The hyperspectral imaging system consists of an imaging spectrometer (ImSpector N17E; Spectral Imaging Ltd., Oulu, Finland), a 320 Â 256 CCD camera (Xeva 992; Xenics Infrared Solutions, Leuven, Belgium) with a camera lens (OLES22; Specim, Spectral Imaging Ltd., Oulu, Finland), and an IRCP0076 electronically controlled mobile platform (Isuzu Optics Corp., Taiwan, China). Two 150 W tungsten halogen lamps (3900 Lightsource, Illumination Technologies Inc., USA) were symmetrically placed on both sides of the lens of Xeva 992 camera as the light source. A black box is used to cover all instruments. When collecting spectra, the black box is closed to ensure dark conditions. A computer is used to control the system with the soware (Xenics N17E, Isuzu Optics Corp., Taiwan).
2.2.2 Image acquisition and correction. Image acquisition was performed at room temperature. At the time of collection, maize seeds were placed on a black at plate and did not overlap with each other. The at plate was placed on the conveyor belt for scanning. In order to obtain a clear image without distortion, the height between the camera lens and the sample was set to 12.6 cm, the exposure time of the camera was set to 3 ms, and the conveyor belt moved at a constant velocity of 11 mm s À1 . The total length of the conveyor belt was 400 mm, and the acquisition time of a hyperspectral image was about 36 s. A black at plate could place 90 maize seeds, so a hyperspectral image could get the information of 90 seeds. Image processing used ENVI 4.6 (ITT Visual Information Solutions, Boulder, Utah, USA) and MATLAB 2015a (The Math Works, Natick, MA, USA).
Aer acquire the hyperspectral images of the samples, it is necessary to correct images to reduce the inuence of dark current. White and black standard reference images are required and acquired under the same experimental condition of the sample's hyperspectral image acquisition. The white standard reference image was obtained by placing a white Teon bar with a reectance of about 100% on the sample position. The black standard reference image was obtained by covering the lens with the opaque lens cap with a reectance of about 0%. The image correction was carried out by following formulas: I c is the normalized image, I raw is the original image, I white is the white reference image, and I dark is the black reference image.

Spectral data extraction.
Aer correcting the acquired hyperspectral images, the maize seeds and the background need to be separated to extract spectral information of the maize seeds. The entire region of each maize seed was dened as the region of interest (ROI), and 40 800 ROIs were used. As shown in Fig. 1, the reectance of the maize seed and the background were different, and the highest variance was about at the wavelength of 1106 nm. In this study, the mask was constructed on the image at 1106 nm by setting the pixels of maize seed area to 1 and the pixels of background to 0. The mask was applied to the grayscale image of each wavelength to separate the maize seeds from the background. Then, the spectrum of each pixel in the ROI region was extracted, which was pixel-wise spectra. Wavelet transform of Daubechies 6 with a decomposition level of 3 was used to smooth the extracted pixel-wise spectra for reducing the random noise. Then, the average spectra of each ROI were calculated by averaging the pixel-wise spectra of each ROI. The calculated average spectra were used to represent the corresponding seed sample and regarded as object-wise spectra. Pixel-wise spectra and objectwise spectra were used for analysis. The extraction of the spectra was conducted in MATLAB 2015a (The Math Works, Natick, MA, USA). Due to the inuence of optical equipment or surrounding environment, noise of the head and end of the spectra was obvious, so the band with obvious noise was removed and the spectra in the range of 975-1646 nm with 200 bands was used.

Principal component analysis
Principal component analysis (PCA) is to project highdimensional data into lower-dimensional space. Using a few new variables (principal components (PCs)) to express the data characteristics of original variables as much as possible. 27,28 Each PC is a linear transformation of the original variable, arranged in descending order of explained variance. The number of PCs can be determined by calculating the cumulative contribution rate of PCs. In this study, the result of PCA analysis showed that the rst six PCs reected 99.98% of the information in the original spectral data. The rst six PCs were used to explore the differences among the samples. The loadings of the principal component (PCA loadings) can reect the correlation between the PCs and the original wavelength variable. The larger loadings of the principal component, the more important the corresponding wavelength variable is. Therefore, the important wavelengths can be recognized. PCA can eliminate the multi-collinearity between variables and reduce data redundancy, and has been applied in near-infrared hyperspectral classication. 29,30 For hyperspectral images, pixel-wise analysis is a method of visualizing PCA scores. 24 A single pixel of the image is calculated to obtain a score for each pixel in each principal component hyperspectral image to form a score visualization image. The difference among the samples can be visually observed in the colourmap of each PC.
In this study, PCA was used for qualitative analysis to explore the separability among maize seeds of different varieties. Secondly, PCA loadings was used to recognize important wavelengths to understand the classication process of maize seeds of different varieties.

Classication analysis methods
Support vector machine (SVM) is a generalized linear classier that classies data in a supervised learning manner. The raw data is mapped into a high-dimensional space, and the hyperplane with the appropriate boundary is optimized to classify different classes. 31,32 SVM is a common classication model, which can improve the prediction ability and classication rate by realizing the optimal classication surface. Proper selection of kernel functions is essential to SVM and affects the performance of SVM. 33 In this study, the radial basis function (RBF) Fig. 1 The main steps of spectral extraction.
This journal is © The Royal Society of Chemistry 2020 RSC Adv., 2020, 10, 11707-11715 | 11709 kernel was used to obtain the optimal performance by determining the parameters of penalty coefficient (c) and the kernel parameter (g). Parameters c and g were generally determined by grid search method, and their search range were from 2 À8 to 2 8 .
Radial basis function neural network (RBFNN) is a three-layer forward network. 34 The rst layer is the input layer, which consists of input nodes and does not process information. The second layer is the hidden layer and its number of elements depends on the need to describe the problem. Each neuron in the hidden layer represents a set of radial basis functions. The third layer is the output layer, it responds to the input mode. 35 The optimal spread value should be determined in the hidden layer. RBFNN can approximate any continuous nonlinear network with arbitrary precision. It has the characteristics of fast learning convergence and simple structure, and has widely used in pattern recognition, function approximation and other elds. 36 In this study, the RBFNN model for the classication of different varieties of maize seeds were established. The performance and the optimal spread value of the model were evaluated and determined according to the classication accuracy.
SVM and RBFNN were commonly used spectral data analysis models, which could get good analysis results. In this study, SVM and RBFNN models were used to quantify the classication results of the spectra collected using NIR-HSI. At the same time, the classication results of the two models could be compared. It could provide a reference for the development of the application of NIR-HSI to classify common and silage maize seeds of different varieties. The implementation of the SVM and RBFNN model was based on the libSVM and nnet toolbox in MATLAB, respectively.

Spectral prole
Using the average spectral reectance of all pixels of one maize seed represented the spectral reectance of one maize seed. There were 5100 maize seeds per variety and 5100 spectral curves were obtained for each variety. Due to the obvious noise in the head and end of the spectral curve, the spectra in the range of 975-1646 nm was analysed. The average spectra of eight different varieties of maize seeds was shown in Fig. 2.
According to the spectral curves in Fig. 2, the average spectra of eight varieties of maize seeds had the similar trends. The valley of the spectra at around 1200 nm might be attributed to the second overtone of C-H in carbohydrates. 36,37 The valley at around 1450 nm was a result of the rst overtone of the combination of the C-H bond in the protein and the O-H bond in moisture. 37 Due to the difference of chemical composition and physicochemical properties among varieties, the spectral reectance values of different varieties were different, which provided the possibility to classify different varieties of maize seeds. In fact, the overlap among the spectra of maize seeds of different varieties was exist, it was necessary to combine chemometrics methods for further analysis.

PCA scores image visualization
PCA analysis was performed on the pixel spectral information of eight varieties of maize seeds. A hyperspectral image of each variety was randomly selected in the obtained hyperspectral images for PCA analysis. The result showed that the rst six PCs reected 99.98% of the information in the original spectral data (94.41%, 5.28%, 0.19%, 0.03%, 0.03% and 0.03% for PC1, PC2, PC3, PC4, PC5 and PC6, respectively). That was to say, these six PCs explained most of the variables in the total variance. The scores of the rst six PCs were multiplied by the corresponding binary of each pixel in the mask, and the score image was formed and visualized by using the colour bar. Fig. 3 shows the visualized hyperspectral images of the rst six PCs of eight varieties of maize seed.
As shown in Fig. 3, the differences among different varieties of maize seeds could be visually displayed by the positive and negative colour scores. It showed that there were differences among different varieties of maize seeds and they could be distinguished. The positive colour scores corresponded warm colours (yellow-red) and negative colour scores corresponded cold colours (green-blue). In score image of PC1, the colour score of hard endosperm of maize seeds was negative, and most of the colour was blue. The colour score of so endosperm of seeds was positive, and most of the scores were high and the colour was red. In score image of PC2, the colour score of hard endosperm tended to be positive and the colour was green, while the scores of so endosperm part were still positive and the colour were red and yellow. According to the score images of PC1 and PC2, PC1 and PC2 were mainly colour contrast, which could distinguish between hard endosperm and so endosperm of maize seeds. Compared with PC1 and PC2, although the contribution rates of PC3, PC4, PC5 and PC6 were relatively small, they could reect the differences between different varieties of maize seeds. For example, in the score image of PC3, the colour score of the Variety QC9 and Variety QC513 were slightly lower than zero, and the colour score of the Variety QC19 was slightly higher than zero. In the score image of PC4, most of the maize seeds in the Variety DT397 and Variety QC9 had negative colour scores, and the blue colour with larger value proportion appeared. The colour score of variety QC19 was mostly positive with more red appeared. In the score image of PC5, most of the maize seeds in the Variety DT397, Variety QC8, Variety QC9 and Variety QC29 had positive colour scores. Among them, the colour scores of Variety QC8 and Variety QC9 were higher and the colour tended to be yellow. The colour scores of most maize seeds in Variety QC11, Variety QC19 and Variety QC513 were negative, and the colour presented were clearly distinguished from that with positive colour scores. In the score image of PC6, the colour score of Variety QC9 was positive overall with prominent colour presented, and it could be clearly classied. PCA scores images could show the differences among different varieties of maize seeds intuitively, but not all varieties could be distinguished obviously, classication models should be established for further analysis.
The important wavelengths were also recognized by using PCA loadings. In the PCA analysis, the cumulative contribution rate of the rst six PCs were over 99.98%, so the important wavelengths were recognized by the load of the rst six PCs. Fig. 4 shows the wavelength-loading plot for the six PCs. Table 1 shows the important wavelengths recognized by PCA loadings, with a total of 18 important wavelengths. Compared with the full wavelengths, the recognized important wavelengths were corresponded to the chemical composition of maize seeds, which showed the possibility of classifying maize seeds varieties. The important wavelengths between 1110 nm and 1380 nm might be attributed to the second overtone of C-H stretch. 38 The spectral band at 1405 nm might be attributed to the O-H stretch. 39 The spectral bands at 1460 nm and 1470 nm might be attribute to the rst overtone of N-H stretching. 40 The spectral bands at 1564 nm, 1588 nm and 1625 nm might be attributed to the N-H stretching. 41

Classication models
The object-wise spectra of each single seed sample were extracted. SVM and RBFNN classication models were established based on object-wise spectra. First, the eight varieties of maize seeds were classied. Second, common maize seeds and silage maize seeds were classied, and four varieties of common maize seeds and four varieties of silage maize seeds were clas-sied, respectively.
3.3.1 Classication of eight varieties of maize seeds. The eight varieties of maize seeds were randomly divided into the calibration and prediction sets at a ratio of 2 : 1 to establish the classication models. For the classication of eight varieties of maize seeds, the penalty parameter (c) of the SVM model was 256 and the kernel function (g) parameter was 0.5. The accuracy of the SVM calibration set and prediction set were 87.10% and 86.87%, respectively. To explore the classication results of   Table 2 shows the confusion matrix of SVM model for classication of eight varieties of maize seeds. As shown in Table 2, except the Variety DT397, all the varieties were well classied with the accuracy of calibration set and prediction set over 91% and 92%, respectively. Most of the Variety DT397 were misclassied as Variety QC29, and a small part was misclassied as Variety QC8, which was the main reason for the low classication accuracy of the eight varieties of maize seeds.
The RBFNN model for the classication of eight maize seeds were established. The spread rate (s) of the RBFNN model was 8.9. The accuracy of the RBFNN calibration set and prediction set were both 88.41%. To explore the classication results of eight varieties of maize seeds, Table 3 shows the confusion matrix of RBFNN model for classication of eight maize seeds. As shown in Table 3, except the Variety DT397 and QC29, all the varieties were well classied with the accuracy of calibration set and prediction set over 97% and 96%, respectively. In the Variety DT397, most of them were misclassied with the accuracy of calibration and prediction only about 37%. Most of Variety DT397 were misclassied as Variety QC29, and a small part was misclassied as Variety QC8. In the Variety QC29, a small part was misclassied, most of which were misclassied as Variety DT397, and a small part was misclassied as other varieties such as QC8, QC13, and QC19.
From Tables 2 and 3, SVM and RBFNN models had the misclassication of Variety DT397 and Variety QC29. Variety DT397 was misclassied as Variety QC29 in SVM model, which also existed in RBFNN model. Besides, Variety QC29 was misclassied as Variety DT397 and other varieties in RBFNN model. Overall, the classication accuracy of RBFNN model was good compared with that of SVM. For different models, the classication of eight varieties of maize seeds has similar results. Different varieties of maize seeds have an impact on classication.
The maize seeds of Variety DT397 is common maize seeds and the Variety QC29 is silage maize seeds. To explore the inuence of varieties on classication results, the classication of common maize seeds and silage maize seeds based on RBFNN model was studied.
3.3.2 Classication of common maize seeds and silage maize seeds. Four varieties of common maize seeds were considered as one class, and four varieties of silage maize seeds were considered as another class. The common maize seeds and silage maize seeds were randomly divided into the calibration and prediction sets at a ratio of 2 : 1 to establish the classication models. The accuracy of the SVM calibration set and prediction set were 87.88% and 87.23%, respectively, with the c of the SVM model was 256 and the g was 4. Table 4 shows the confusion matrix of SVM model for classication of common maize seeds and silage maize seeds. As shown in Table 4, the accuracy of calibration set and prediction set for the classication of common maize seeds were slightly higher than that of silage maize seeds. The accuracy of calibration set and prediction set for the classication of common maize seeds in SVM model were higher than 88%, and the accuracy of calibration set and prediction set for the classication of silage maize seeds were higher than 85%.
There might be similarities in appearance and composition among different varieties of common maize seeds and different varieties of silage maize seeds, causing confusion in the clas-sication process.
The RBFNN model was used to classify the common maize seeds and silage maize seeds, with the s of the RBFNN model was 8.5. The accuracy of the RBFNN calibration set and prediction set were both 88.41%. Table 6 shows the confusion  matrix of RBFNN model for classication of common maize seeds and silage maize seeds. Misclassication was existed between the common maize seeds and silage maize seeds. As shown in Table 6, the accuracy of calibration set and prediction set for the classication of common maize seeds in RBFNN model were higher than 88%, and the accuracy of calibration set and prediction set for the classication of silage maize seeds were both 88.57%. The comparison between the classication results of SVM model and RBFNN model could be seen in Table 4. There existed misclassication between different varieties of maize seeds. SVM model and RBFNN model had the similar results, and the classication accuracy of RBFNN model were slightly higher than that of SVM model.
3.3.3 Classication of four varieties of common maize seeds and four varieties of silage maize seeds. Considering the inuence of maize varieties in the process of classication, the classication of four varieties of common maize seeds and four varieties of silage maize seeds was studied respectively. Four varieties of common maize seeds and four varieties of silage maize seeds were randomly divided into the calibration and prediction sets at a ratio of 2 : 1 to establish the classication models.
For the classication of four varieties of common maize seeds, the c of the SVM model was 256 and the g was 2. The accuracy of the SVM calibration set and prediction set were 97.46% and 97.25%, respectively. The s of the RBFNN model was 22.8. The accuracy of the RBFNN calibration set and prediction set were 98.49% and 98.09%, respectively. Table 5 shows the confusion matrix of SVM model and RBFNN model for the classication of four varieties of common maize seeds. As shown in Table 5, the SVM model and RBFNN model had similar results. Variety DT397 and Variety QC8 were likely to be misclassied. Variety QC11 and Variety QC13 were well classi-ed with the accuracy higher than 99%. The classication accuracy of RBFNN model were slightly higher than that of SVM model.
The accuracy of the SVM calibration set and prediction set were 99.40% and 98.66%, respectively. The s of the RBFNN model was 12.8. The accuracy of the RBFNN calibration set and  prediction set were 98.49% and 98.09%, respectively. Table 6 shows the confusion matrix of SVM model and RBFNN model for the classication of four varieties of silage maize seeds. As shown in Table 6, the SVM model and RBFNN model had similar results. All varieties of silage maize seeds were well classied, with the accuracy of about 99%. From Tables 5 and 6, SVM model and RBFNN model showed similar performances for the classication of four varieties of common maize seeds and the classication of four varieties of silage maize seeds. Four varieties of silage maize seeds could be well classied. In the classication of four varieties of common maize seeds, Variety DT397 and Variety QC8 had obvious misclassication, but had little effect on the overall classication accuracy. SVM model and RBFNN model could be used to classify different varieties of maize seeds. Different classication models showed similar results for the classication of different varieties of maize seeds, conrming the identiability among different varieties of maize seeds.

Conclusions
The classication of maize seeds of different varieties based NIR-HSI was studied. The classication of seeds of silage maize and common maize was involved, and the classication of the seeds into four varieties of silage maize and four varieties common maize respectively were also involved. Maize seeds pixel-wise spectra were extracted to conduct PCA analysis and form the PCA scores images. The scores images of the rst six PCs indicated the difference among different varieties of maize seeds. Based on the extracted object-wise spectrum of each single seed sample, the SVM and RBFNN classication models were established, and satisfactory classication results were obtained. For the classication of eight varieties of maize seeds, the prediction accuracy of the SVM model and RBFNN model were 86.87% and 88.41%, respectively. For the classication of common maize seed and silage maize seeds, the prediction accuracy of the SVM model and RBFNN model were 88.23% and 88.41%, respectively. For the classication of four varieties of common maize seeds, the prediction accuracy of the SVM model and RBFNN model were 97.25% and 98.09%, respectively. For the classication of four varieties of silage maize seeds, the prediction accuracy of the SVM model and RBFNN model were 98.66% and 99.10%, respectively.
The classication of maize seeds of different varieties based on NIR-HSI was feasible. The classication of common maize seeds and silage maize seeds and the classication of different varieties of silage maize seeds based on NIR-HSI could be achieved. The approach did not require complicate sample pretreatment. It was fast and convenient. In the future, the varieties and the number of samples should be increased to establish a maize seeds classication library, which is more convenient for rapid classication of maize seeds.

Conflicts of interest
There are no conicts to declare.