## Materials and Methods
### Data Analysis  
Hyperspectral images were analyzed using ENVI v.5.1 (Exelis Visual Information Solutions Inc., Redlands, CA, USA). Before analysis, spectra range was reduced to 1000-2500 nm for noise reduction. Regions of interest (ROIs) of maize kernels of each image were identified and selected in order to mask the background, Petri dishes and labels in the image. Principal component analysis (PCA) as an unsupervised classification algorithm has the ability to separate data with distinct differences. Thus, PCA was applied on the image for the selection of ROIs of maize kernels [18]. After the selection, inverse PCA was used to reduce noise by removing some PCs that represented noise information, and transform PCs back to wavelengths for subsequent analysis. Then, a mask built with ROIs was applied to obtain a clean image without irrelevant information, such as label and background. After that, each clean image was resized to remove the blank edges around the kernels, and then all eight of the resized images were integrated to construct a mosaic. It is well-known that PCA can reduce data dimensionality by transforming the raw large number of inter-correlated variables into fewer and orthogonal variables, which are referred to as PCs. PCs are calculated based on the maximum variance of the data, and they are in descending order according to the percentage of variance. Generally, the last PCs are for noise and can be removed. Based on hyperspectral image data, PC loading line plots and PC score images can be displayed and discussed interactively to explore spectra and image information simultaneously. In this research, PCA was applied on the mosaic to reduce data dimensionality and noise to benefit the next classification of different fungal contamination levels. Computation of ROI separability in ENVI software is usually applied to have a preliminary observation on classification effect of data before application of a classification modeling algorithm. The separation results are calculated on every two classes, represent the separable ability between two classes, and are shown in a list of values for all of the pairs of classes. The separability values vary from 0 to 2. The closer the value to 2, the better the separation for the two classes performed. In this work, the separability for the eight groups was calculated based on two types of data sets, one of which is data of the whole kernel, and the other is data of the germ region. The sample kernels of one Petri dish, on which kernels were orientated with germ up, were used. Elliptical ROIs of the germ region on each kernel were hand-digitized using ENVI software. The mean reflectance from each ROI of the germ region of kernel samples of the two Petri dishes was calculated. Samples from both of the two Petri dishes made a data set with 1:1 for the number of kernels orientated with germ up and germ down, which was used for discussion on the influence on classification models caused by germ orientation. For the samples orientated with germ down, the germ region was defined as the area symmetrical to the germ portion. Spectral data was analyzed using MATLAB software (The Math Works, Natick, MA, USA). The raw spectral data (from ROIs) contained scattering noise generated by a camera, random noise, baseline offset, non-uniformity and surface scattering in samples [28]. Therefore, to highlight the effective information, pretreatment techniques were applied. In this study, the mathematical pretreatment techniques used were Savitzky-Golay smoothing (SGS), moving average smoothing (MAS), normalization (NMZ), standard normal variate (SNV), and multiple scatter correction (MSC), as well as their combinations. SGS and MAS are moving window methods used to eliminate overlapping peaks due to random noise [29; 30]. NMZ, SNV and MSC were scatter-correction methods and designed to remove the slope variation from the spectra generated by the scatter and variation of particle size and adjust baseline shifts between samples [31; 32; 33].