*3.2. Spectral and Texture Characterization*

The curves of original spectra and texture data extracted from the hyperspectral images of Vis-SWNIR and LWNIR regions were shown in Figure 4. The solid lines and the shaded part of Figure 4a,b are the average spectra and the standard deviation of maize with different moldy levels, respectively. Figure 4c–j shows the texture data of contrast, correlation, energy, and homogeneity extracted from the ROI of all samples. It was clear that both spectra data and texture data of maize with different moldy levels had similar trends, but their reflectance intensity were significantly different, which may be related to the decomposition of chemical substances in the process of maize mold.

**Figure 4.** *Cont*.

**Figure 4.** Spectra and texture curves of maize with different moldy levels in the Vis-SWNIR region (left) and LWNIR region (right): (**a**) original spectra in Vis-SWNIR region; (**b**) original spectra in LWNIR region; (**c**) contrast parameter in Vis-SWNIR region; (**d**) contrast parameter in LWNIR region; (**e**) correction parameter in Vis-SWNIR region; (**f**) correction parameter in LWNIR region; (**g**) energy parameter in Vis-SWNIR region; (**h**) energy parameter in LWNIR region; (**i**) homogeneity parameter in Vis-SWNIR region; (**j**) homogeneity parameter in LWNIR region.

By analyzing the spectral curve characteristics, it can be easily found that the more serious maize mold, the lower the spectral reflection intensity in both wavelength regions, indicating that the light absorption capacity of mold tissue was stronger than that of maize tissue. The spectral curve is monotonous in the Vis-SWNIR region, the average spectral curve gradually increased in the region of 399–820 nm and then decreases slowly. However, the spectral curve was complicated and varied in the LWNIR region. Two obvious reflectance peaks were captured around 1100 nm and 1300 nm, respectively. The former may be related to C-H in lipids [47], and the latter can be designated as a combination between the first overtone of N-H stretching with the fundamental N-H in-plane bending and C-N stretching with N-H in-plane bending vibrations [48]. In addition, there were two obvious absorption peaks at 1192 nm and 1445 nm. The peak at 1192 nm may be associated with the second overtone of C-H stretching in carbohydrates [49] and at 1445 nm may be related to the O-H bond in water and the first overtone of C-H in protein [50]. There were significant differences in the reflectance spectra and texture intensity between different moldy levels. These differences may provide the possibility of classifying the maize with different moldy levels. However, the spectra of maize samples with different moldy levels crossed in some wavelength intervals (1400–1701 nm), and there was no significant correlation between the reflectance spectra and the moldy levels. Hence, the spectra and textures should be fused to research the classification ability of their latent information.

#### *3.3. Comparison and Optimization of Different Classifiers and Preprocessing Methods*

In non-destructive detection technology based on visible and near-infrared hyperspectral images, many spectral preprocessing methods and classifiers can be used to construct the classification model. In order to improve the development efficiency of the classification models, the classifier and spectral preprocessing method were firstly determined in this study based on the original spectral data. Three classification algorithms, including SVM, RF, and KNN, were used to build the classification model based on the original spectra extracted from different hyperspectral systems. Table 2 shows the CAT activity value of the calibration and prediction datasets. It should be pointed out that the samples in the calibration and prediction sets were kept unchanged and no single sample was used in calibration set and prediction set at the same time. The results of different classification algorithms were shown in Figure 5. Compared the overall classification accuracy yielded by different classifiers, SVM was the most robust classifier with the accuracy of calibration and prediction sets of 93.89% and 86.67%, and 86.67% and 85% for Vis-SWNIR and LWNIR regions, respectively. Hence, SVM was used as the only classifier to build the classification models in the subsequent data processing. In terms of the classification accuracy built by

the SVM models, the LWNIR region was poorer than the Vis-SWNIR region, which may be due to the weak correlation between the spectral intensity and the level of mold in the 1400–1701 wavelength range, as can be seen by the spectral characteristic curve.


**Table 2.** Division of maize with different moldy levels in the calibration and prediction sets.

**Figure 5.** The classification results of different classifiers based on the original spectra of Vis-SWNIR and LWNIR hyperspectral systems.

In terms of spectral preprocessing methods, to reduce the noise and interference in the original spectral information, the 9-point smooth method was firstly used to eliminate the noise existed in the original spectra. Then msc, detrend, and center methods were carried out on the basis of smoothed spectra to further optimize the spectral data, and the influence of different preprocessing methods on classification accuracy was compared. The average spectra preprocessed by different method were shown in Figure 6a–f. It can be seen that these preprocessing methods effectively eliminate signal offset and light scattering. The classification results of different preprocessing methods were shown in Table 3. For the case of the Vis-SWNIR region, the best preprocessing method was smoothdetrend with the classification accuracy of 86.67% and 88.33% for the calibration set and prediction set, respectively, because the accuracy gap between the calibration set and prediction set was the smallest. For the case of the LWNIR region, the model developed by smooth-detrend spectra achieved better prediction performance with the classification accuracy of 90.56% and 88.33% for the calibration set and prediction set, respectively. All

classification models developed by the spectra preprocessed by smooth-detrend were superior to the model developed by original spectra, proving that spectral processing could greatly improve the reliability of classification models. The detrend could eliminate the influence of different sampling batches on the spectrum and improve the robustness and accuracy of the classification model. Sanchez et al. [35] improved the prediction ability of strawberry quality parameters by using detrend spectral pretreatment method. Paz et al. [51] found that detrend pretreatment had better prediction effect on sugar content and hardness in plums. Furthermore, the method of spectral pretreatment depends largely on the analyte being modeled and must be based on the judgment of the analyst [52]. In this study, smooth-detrend was selected as the most optimal spectral preprocessing method, and the spectra pretreated by smooth-detrend preprocessing were used for subsequent analysis instead of the original spectra in both Vis-SWNIR and LWNIR regions.

**Figure 6.** The preprocessed spectra by smooth-msc (**a**,**d**), smooth-detrend (**b**,**e**), and smooth-center (**c**,**f**) methods for the Vis-SWNIR and LWNIR regions, respectively.

**Table 3.** The classification performance of the SVM models established by different preprocessing methods.

