Nondestructive Classification of Maize Moldy Seeds by Hyperspectral Imaging and Optimal Machine Learning Algorithms

Mildew of maize seeds may affect their germination rates and reduce crop quality. It is crucial to classify maize seeds efficiently and without destroying their original structure. This study aimed to establish hyperspectral datasets using hyperspectral imaging (HSI) of maize seeds with different degrees of mildew and then classify them using spectral characteristics and machine learning algorithms. Initially, the images were processed with Otus and morphological operations. Each seed’s spectral features were extracted based on its coding, its edge, region of interest (ROI), and original pixel coding. Random forest (RF) models were optimized using the sparrow search algorithm (SSA), which is incapable of escaping the local optimum; hence, it was optimized using a modified reverse sparrow search algorithm (JYSSA) strategy. This reverse strategy selects the top 10% as the elite group, allowing us to escape from local optima while simultaneously expanding the range of the sparrow search algorithm’s optimal solution. Finally, the JYSSA-RF algorithm was applied to the validation set, with 96% classification accuracy, 100% precision, and a 93% recall rate. This study provides novel ideas for future nondestructive detection of seeds and moldy seed selection by combining hyperspectral imaging and JYSSA algorithms based on optimized RF.


Introduction
Corn has a reputation as a "golden crop"; even though the seed is small, the crop is vital to China and plays a major role in the international trade in corn seeds. It is of great significance that there are independent and controllable seed sources in the seed industry. High temperature and humidity cause mold to grow on seeds, reducing their germination rates, as well as their quality and nutritional value [1,2]. Over the past few decades, crop diseases have been a frequent cause of crop yield reduction, and their cause must be determined by studying the diseased seeds [3,4]. The seed industry must speed up the promotion of corn seed science, perform efficient seed discrimination, achieve independent self-improvement, and be able to control seed quality independently. Chemical composition analysis is the approach that provides the most precise indication of the level of mold present [5]; however, there is inevitably some damage to the sample, as well as subjective considerations, in the process of analysis [6]. A new and innovative technological tool has emerged in recent years for the nondestructive testing of seeds, known as hyperspectral imaging [7][8][9][10]. Hyperspectral remote sensing imaging (HRSI) uses spectral signatures to identify, detect, and discriminate between objects of varying spectral characteristics [11]. The results are directly proportional to the spectral resolution of the sensor and how much information is stored in each band [12]. Sensors with high resolution tend to have feature subsets in the random forest classifier, and search for each of their optimal solutions. This is the first time that a novel approach has been used in the area of nondestructive testing to address the issue of choosing RF model parameters from a large variety of wavelengths, an issue that plays a significant role in the exploration of efficient and comprehensive methods of detecting mold in maize seeds of various ages.

Hyperspectral Imaging and Data Acquisition
The system consisted of a Resonon hyperspectral imager (Pika XC2, Resonon Inc., Bozeman, MT, USA) and a computer equipped with data acquisition and control using display software (SpectrononPro, Resonon Inc., USA). The imaging spectrometer has a spectral range of 400-1000 nm, a 50 μm slit, a spectral resolution of 1.3 nm, and a spatial resolution of 0.15 mm/pixel. The other three important components of the entire hyperspectral system are the mount, light source, and camera, as shown in Figure 1. One of the keys to the linear scanning of the hyperspectral imaging instrument is the linear mover, which moves at a uniform rate of 500 steps. The second essential component is the light source. A sufficient and smooth light source plays a crucial role in a hyperspectral imaging system. A combination of an illumination unit (OSRAM, Munich, Germany) and a 4-lamp illumination system (35 W per lamp, for a total input power of 140 W and a total radiated power of about 5-7 W) provided the light source for hyperspectral imaging (XENOPLAN, F/1.4 FL23 mm, Schneider-Kroetsch, Bad Kroetsch, Germany), and the health sample was placed on a matte cloth. The optimal parameters of the swept spectra were adjusted on a plate-on-mount table with an extinction cloth as follows: object distance of 13.5 cm, exposure time of 7 ms, linear translation table moving at 3.4 mmsl, wavelength range of 400-1000 nm, spectral resolution of 1.3 nm, and 462 bands of scanning hyperspectral images.
The Jilin Academy of Agricultural Sciences supplied the maize seeds. As described in [25], we divided the corn seeds into five groups based on the amount of mold coverage (Table 1) and then placed them on five square plates covered with matting cloth [26]. For smooth irradiation of maize seeds, the instrument needed to be preheated before scanning the seeds.  The second essential component is the light source. A sufficient and smooth light source plays a crucial role in a hyperspectral imaging system. A combination of an illumination unit (OSRAM, Munich, Germany) and a 4-lamp illumination system (35 W per lamp, for a total input power of 140 W and a total radiated power of about 5-7 W) provided the light source for hyperspectral imaging (XENOPLAN, F/1.4 FL23 mm, Schneider-Kroetsch, Bad Kroetsch, Germany), and the health sample was placed on a matte cloth. The optimal parameters of the swept spectra were adjusted on a plate-on-mount table with an extinction cloth as follows: object distance of 13.5 cm, exposure time of 7 ms, linear translation table moving at 3.4 mmsl, wavelength range of 400-1000 nm, spectral resolution of 1.3 nm, and 462 bands of scanning hyperspectral images.
The Jilin Academy of Agricultural Sciences supplied the maize seeds. As described in [25], we divided the corn seeds into five groups based on the amount of mold coverage (Table 1) and then placed them on five square plates covered with matting cloth [26]. For smooth irradiation of maize seeds, the instrument needed to be preheated before scanning the seeds.

Image Processing and Spectral Extraction
Digital image processing techniques were used to extract the spectral data of the edges of each corn seed, as shown in Figure 2. This was caused by reflection from the sample surface. For the optical darkroom (all of the labs were treated with matte cloth), (a) the blackboard-and whiteboard-corrected images were acquired using a masking lens and standard whiteboard acquisition before scanning (598.71 nm wavelength was the clearest), and (b) applying the Otus threshold method to the 598.71 nm image revealed a clear sample. Next, morphological opening and closing operations were used to establish the sample edges, and the samples were numbered according to the pixels along the edges. (c) By automating the selection of separate hyperspectral bands using masks determined by the numbering and annotation of ROIs, the identification of multiple bands could be achieved. (d) Finally, the wavelength features were implemented across all samples. After the ROI process had been conducted, the radiation values of each pixel point were corrected and recalibrated by referring to the calibration calculation formula, which is defined as follows: where C S indicates the calibrated image information, C w is the whiteboard information, and C D is the all-black image information when the dark current is acquired. We found that all of the pixels in each seed were averaged and transformed into the hyperspectral reflectance data of each corn seed, and the corresponding spectral data were extracted in the order of the corn seed numbers.

Image Processing and Spectral Extraction
Digital image processing techniques were used to extract the spectral data of the edges of each corn seed, as shown in Figure 2. This was caused by reflection from the sample surface. For the optical darkroom (all of the labs were treated with matte cloth), (a) the blackboard-and whiteboard-corrected images were acquired using a masking lens and standard whiteboard acquisition before scanning (598.71 nm wavelength was the clearest), and (b) applying the Otus threshold method to the 598.71 nm image revealed a clear sample. Next, morphological opening and closing operations were used to establish the sample edges, and the samples were numbered according to the pixels along the edges. (c) By automating the selection of separate hyperspectral bands using masks determined by the numbering and annotation of ROIs, the identification of multiple bands could be achieved. (d) Finally, the wavelength features were implemented across all samples. After the ROI process had been conducted, the radiation values of each pixel point were corrected and recalibrated by referring to the calibration calculation formula, which is defined as follows: where S C indicates the calibrated image information, w C is the whiteboard information, and D C is the all-black image information when the dark current is acquired.
We found that all of the pixels in each seed were averaged and transformed into the hyperspectral reflectance data of each corn seed, and the corresponding spectral data were extracted in the order of the corn seed numbers.  For better presentation of the three-dimensional data, these data are converted into two-dimensional data to make it more obvious. As depicted in Figure 3, the scanning of maize seeds through a hyperspectral imaging system generates three-dimensional images consisting of 1500 lines, 1600 samples, and 462 bands. Each band's arrangement can be better understood by using binary expansion. For better presentation of the three-dimensional data, these data are converted into two-dimensional data to make it more obvious. As depicted in Figure 3, the scanning of maize seeds through a hyperspectral imaging system generates three-dimensional images consisting of 1500 lines, 1600 samples, and 462 bands. Each band's arrangement can be better understood by using binary expansion.

JYSSA Algorithm to Optimize the RF Mode
A traditional SSA divides S into three categories based on their energy levels during foraging: explorers, followers (starvation, competition, and ordinary gradual followers), and probers. In the subsection on the S search process, it can be seen that the finder is in the middle and the first to find food from a safe position, as shown in Figure 4. The SSA algorithm is relatively robust, with simple role assignments and few parameters. However, precisely because of the small number of roles and the lack of chain mechanism in the process of cyclic update of positions, it is prone to local optimum, which is considered to give search results instead of the global optimum, and the global optimum is replaced by the local optimum [27,28].

JYSSA Algorithm to Optimize the RF Mode
A traditional SSA divides S into three categories based on their energy levels during foraging: explorers, followers (starvation, competition, and ordinary gradual followers), and probers. In the subsection on the S search process, it can be seen that the finder is in the middle and the first to find food from a safe position, as shown in Figure 4.
For better presentation of the three-dimensional data, these data are converted into two-dimensional data to make it more obvious. As depicted in Figure 3, the scanning of maize seeds through a hyperspectral imaging system generates three-dimensional images consisting of 1500 lines, 1600 samples, and 462 bands. Each band's arrangement can be better understood by using binary expansion.

JYSSA Algorithm to Optimize the RF Mode
A traditional SSA divides S into three categories based on their energy levels during foraging: explorers, followers (starvation, competition, and ordinary gradual followers), and probers. In the subsection on the S search process, it can be seen that the finder is in the middle and the first to find food from a safe position, as shown in Figure 4. The SSA algorithm is relatively robust, with simple role assignments and few parameters. However, precisely because of the small number of roles and the lack of chain mechanism in the process of cyclic update of positions, it is prone to local optimum, which is considered to give search results instead of the global optimum, and the global optimum is replaced by the local optimum [27,28]. The SSA algorithm is relatively robust, with simple role assignments and few parameters. However, precisely because of the small number of roles and the lack of chain mechanism in the process of cyclic update of positions, it is prone to local optimum, which is considered to give search results instead of the global optimum, and the global optimum is replaced by the local optimum [27,28].
In terms of initialized populations, the SSA algorithm is improved by adding the elite reverse strategy, the selection of 10% of S as elite S, and the forward and reverse solutions that enable the algorithm to reach more exploration points, effectively eliminating the unknown nature of the algorithm due to random assignment of initial populations, suppressing the algorithm from falling into local optima, and improving its convergence speed.
The search range increases, as usual, which means an ordinary S to choose into an elite S should raise their energy level and expand their foraging abilities, making an explorer S and followers ordinary S compete internally for elite S qualification, the typical follower S does not constantly look for food sources in comparison to their own higher energy explorer S, but instead jumps out of the explorer's foraging judgment and falls into the local extreme value point, to improve the overall algorithm of global searchability, the degree of accuracy has been increased.
The explorer mainly finds food from the forward and reverse search when updating the position according to Equation (2).
where t denotes the iteration counter, and Q is a random number satisfying a normal distribution.
The introduction of the reverse solution allows the explorer to conduct a large-scale search: when R 2 ≤ ST, a predator approaches some S, an alarm signal is immediately issued, and all S quickly fly to other safe areas.
Followers, due to their low energy cannot perform foraging movements and can only be constantly supervised by the explorer. When the explorer finds food, signals will be fed back to the followers, and they will immediately update their position according to Equation (3) to plunder food, which is an opportunity to become an explorer.
where X p is the population center safety position. X worst denotes the current global worst position. A denotes the 1 × d matrix in which each element is randomly assigned by 1 or −1, the; when i > n/2, it indicates that the first i follower with poor health value is most likely to be in the starvation state. Among them, spotters account for 10-20% of the population size, and their initial positions are randomized. When the natural enemy raided, the spotters immediately updated their positions and gave warning signals according to the following equation where X best is the current global optimal position. β is the step control parameter from a normal distribution of random numbers with a mean and variance of 1. K is the moving step of a random number. f w is the worst adaptation value. f g is the optimal fitness value. ε is the smallest constant that circumvents the absolute zero point. The JYSSA algorithm optimizes the RF classification model, as shown in Figure 5, with the following flow.
(1) Full wavelength with feature selected band as input with input sizes of 462 and 186.
(2) Initialize the S population to assign explorers and followers and iterate through the loop by searching the S population's search range in reverse. (7) Update the fitness value again, determine whether the optimal individual is found, and pass the number of trees and feature subsets to the RF model if found; otherwise, repeat Steps (2)- (6).
loop by searching the S population's search range in reverse. (3) Calculate the fitness value for each individual, ranked in order of high and low. (4) Update the explorer, follower, and probe positions according to Equations (2)-(4). (5) Calculate the fitness value again and reorder it, determine whether the maximum number of iterations and the expected convergence effect are satisfied, and if so, continue to the next step; otherwise return to (3). (6) Select elite S, obtain dynamic boundaries, and update elite S positions using the elite reversal strategy. (7) Update the fitness value again, determine whether the optimal individual is found, and pass the number of trees and feature subsets to the RF model if found; otherwise, repeat Steps (2)-(6).

Model Prediction and Testing
The training and test sets were divided hyperspectrally into , where the test set data were preprocessed with n data, representing the total number of bands. In the SSA-optimized RF model, and n n corn label represent the spectral features of maize seeds and the authenticity labels for those seeds, respectively. For this paper, accuracy, precision, and recall were used to evaluate the results of the classification. The testing sets were classified by the research method only if they gave the same classification result as the pre-classified results; otherwise, the classification was considered incorrect. The formulae of precision, recall, and evaluation index are as follows:

Model Prediction and Testing
The training and test sets were divided hyperspectrally into C = {(corn 1 , label 1 ), . . . , (corn n , label n )}, where the test set data were preprocessed with n data, representing the total number of bands. In the SSA-optimized RF model, corn n and label n represent the spectral features of maize seeds and the authenticity labels for those seeds, respectively.
For this paper, accuracy, precision, and recall were used to evaluate the results of the classification. The testing sets were classified by the research method only if they gave the same classification result as the pre-classified results; otherwise, the classification was considered incorrect. The formulae of precision, recall, and evaluation index are as follows: where C n indicates that the label is in class n, and classified as n seeds of corn labeled as a class; S n denotes the total number of corn seeds labeled as n; T n denotes the true label; n denotes the total number of corn seeds in the test set with the true label; C p denotes the total number of correctly predicted classes for the entire process p of the total number of maize seeds; and C m denotes the total number of maize seeds in the entire dataset.

Analysis of Spectral Curves of Maize Seeds with Different Degrees of Mildew
Using the hyperspectral imaging system, curve images were obtained with different degrees of hyperspectral characteristics for five classes of maize seeds, totaling 60 grains for each class. The spectral curves of each maize seed in the five classes of seeds were corrected according to the digital image processing described in Section 2.1 Figure 6a shows the spectral curve of healthy seeds, which is used as a criterion for judging moldy seeds. Figure 6b shows the phenomenon of wave peaks between 500 and 700 nm, and the curve is different from that shown in Figure 6a. In Figure 6c-e, the reflectance gradually decreases from 500 to 700 and 700 to 900 nm; mold between the corn seeds causes the absorption of light, and the reflectance of the wave crest gradually decreases. corrected according to the digital image processing described in Section 2.1 Figure 6a shows the spectral curve of healthy seeds, which is used as a criterion for judging moldy seeds. Figure 6b shows the phenomenon of wave peaks between 500 and 700 nm, and the curve is different from that shown in Figure 6a. In Figure 6c-e, the reflectance gradually decreases from 500 to 700 and 700 to 900 nm; mold between the corn seeds causes the absorption of light, and the reflectance of the wave crest gradually decreases. In addition to SNV, MSC, smoothing, etc., the first derivative and second derivative were used to process the spectral curves. In order to calibrate the standard normal variate (SNV), each wavelength point's absorbance value must fall into a certain distribution along the spectral curve. The rows of the spectral matrix determine which spectrum to handle using the SVN. In short, multiplicative scatter correction (MSC) eliminates scattering losses caused by uneven particle size distributions and uneven particle distributions. In order to minimize spectral differences, MSC tries to preserve as much chemical-related information as possible throughout the spectrum. Based on the algorithm, the wavelength In addition to SNV, MSC, smoothing, etc., the first derivative and second derivative were used to process the spectral curves. In order to calibrate the standard normal variate (SNV), each wavelength point's absorbance value must fall into a certain distribution along the spectral curve. The rows of the spectral matrix determine which spectrum to handle using the SVN. In short, multiplicative scatter correction (MSC) eliminates scattering losses caused by uneven particle size distributions and uneven particle distributions. In order to minimize spectral differences, MSC tries to preserve as much chemical-related information as possible throughout the spectrum. Based on the algorithm, the wavelength and sample concentration are not taken into account when calculating the scattering. Instead of preprocessing a single curve, MSC and SVN preprocess sets of sample curves.
Since the first and second derivatives are obtained after taking the derivatives of the curves, background interference is eliminated, and the resolution is improved. The derivative can increase the resolution and the number of wavelength sampling points, but it amplifies the noise and reduces the signal-to-noise ratio when processing highfrequency noise. From Figure 7, it can be seen that the MSC and SVN algorithms were both used concurrently to preprocess all kinds of maize mildew degree curves. Instead of preprocessing a single curve, MSC preprocesses a set of sample curves; a single spectral curve is best preprocessed with SVN.

Data Dimensionality Reduction and Feature Selection
The hyperspectral imaging system provides a wealth of data, but when the number of band operations increases, the training time also increases because the band attribute values are too low, reducing the accuracy [29]. For this reason, RF features and importance ranking were used. All bands were given their scores, facilitating the screening of high-priority bands. Figure 8 mainly shows the 186 feature bands with importance scores greater than 0, which were screened in the experiment for comparison with the full 462 bands. curves, background interference is eliminated, and the resolution is improved. The derivative can increase the resolution and the number of wavelength sampling points, but it amplifies the noise and reduces the signal-to-noise ratio when processing high-frequency noise. From Figure 7, it can be seen that the MSC and SVN algorithms were both used concurrently to preprocess all kinds of maize mildew degree curves. Instead of preprocessing a single curve, MSC preprocesses a set of sample curves; a single spectral curve is best preprocessed with SVN.

Data Dimensionality Reduction and Feature Selection
The hyperspectral imaging system provides a wealth of data, but when the number of band operations increases, the training time also increases because the band attribute values are too low, reducing the accuracy [29]. For this reason, RF features and importance ranking were used. All bands were given their scores, facilitating the screening of highpriority bands. Figure 8 mainly shows the 186 feature bands with importance scores greater than 0, which were screened in the experiment for comparison with the full 462 bands. Feature bands were selected based on preprocessed data. As part of the selection process, competitive adaptive reweighted sampling (CARS) was adopted, which relies primarily on Monte Carlo analysis and PLS regression to find the feature wavelengths. After continuous PLS cross-validation (RMSECV) shrinking, a maximum root-mean-square error characteristic wavelength subset was found, and the PLS model was re-established through the new subset according to Darwin's theory of evolution. There were eight training sets and two test sets in the wavelength dataset, and the number of Monte Carlo samplings was fixed. In Figure 9, the absolute weight of the regression coefficient is shown for each sampling process. When determining the optimal characteristic wavelengths, small absolute wavelengths were discarded directly through the decreasing function (EDF) and then cross-validated to minimize the RMSECV. Feature bands were selected based on preprocessed data. As part of the selection process, competitive adaptive reweighted sampling (CARS) was adopted, which relies primarily on Monte Carlo analysis and PLS regression to find the feature wavelengths. After continuous PLS cross-validation (RMSECV) shrinking, a maximum root-mean-square error characteristic wavelength subset was found, and the PLS model was re-established through the new subset according to Darwin's theory of evolution. There were eight training sets and two test sets in the wavelength dataset, and the number of Monte Carlo samplings was fixed. In Figure 9, the absolute weight of the regression coefficient is shown for each sampling process. When determining the optimal characteristic wavelengths, small absolute wavelengths were discarded directly through the decreasing function (EDF) and then cross-validated to minimize the RMSECV. marily on Monte Carlo analysis and PLS regression to find the feature wavelengths. After continuous PLS cross-validation (RMSECV) shrinking, a maximum root-mean-square error characteristic wavelength subset was found, and the PLS model was re-established through the new subset according to Darwin's theory of evolution. There were eight training sets and two test sets in the wavelength dataset, and the number of Monte Carlo samplings was fixed. In Figure 9, the absolute weight of the regression coefficient is shown for each sampling process. When determining the optimal characteristic wavelengths, small absolute wavelengths were discarded directly through the decreasing function (EDF) and then cross-validated to minimize the RMSECV.

Optimal Model Parameters
There is a clear trend that the SSA jumps out of the local optimum but does not continue to search for the optimal solution, while the JYSSA algorithm continues to decline after jumping out of the local optimum, and its ability to jump out of the local optimum and search for the global optimum is improved compared with the original algorithm. Tables 2 and 3 optimize parameters between different algorithms for band 462 and band 186, respectively. Figure 10 compares the convergence and degree of adaptation of the

Optimal Model Parameters
There is a clear trend that the SSA jumps out of the local optimum but does not continue to search for the optimal solution, while the JYSSA algorithm continues to decline after jumping out of the local optimum, and its ability to jump out of the local optimum and search for the global optimum is improved compared with the original algorithm. Tables 2 and 3 optimize parameters between different algorithms for band 462 and band 186, respectively. Figure 10 compares the convergence and degree of adaptation of the SSA and JYSSA algorithms. The optimal adaptation degree is taken to evaluate the performance of the algorithm, and the lower the optimal adaptation degree, the better the algorithm's effect [30].

Comparison of Classification Models and Experimental Results
The ordinary RF model was constructed using an RF classifier with n_estimators = 5 and max_features = 3 in the training classification mode. The SSA and JYSSA algorithms' optimized parameters are reflected in Section 2.3. The comparison of the three algorithms of the test set and training set under 462 bands and 186 bands is shown in Figure 11, and the training set prediction results are represented in different legends to judge whether the training set is accurate with respect to the coverage degree of scattering and the true value, where the blue pentagram represents the true value label, and the blue dots, red dots, and green dots represent the training set prediction of the RF, SSA-RF, and JYSSA-RF models, respectively. The yellow, red, and green dots represent the test sets of the RF, SSA-RF, and JYSSA-RF models, respectively.

Comparison of Classification Models and Experimental Results
The ordinary RF model was constructed using an RF classifier with n_estimators = 5 and max_features = 3 in the training classification mode. The SSA and JYSSA algorithms' optimized parameters are reflected in Section 2.3. The comparison of the three algorithms of the test set and training set under 462 bands and 186 bands is shown in Figure 11, and the training set prediction results are represented in different legends to judge whether the training set is accurate with respect to the coverage degree of scattering and the true value, where the blue pentagram represents the true value label, and the blue dots, red dots, and green dots represent the training set prediction of the RF, SSA-RF, and JYSSA-RF models, respectively. The yellow, red, and green dots represent the test sets of the RF, SSA-RF, and JYSSA-RF models, respectively.

Comparison of Classification Models and Experimental Results
The ordinary RF model was constructed using an RF classifier with n_estimators = 5 and max_features = 3 in the training classification mode. The SSA and JYSSA algorithms' optimized parameters are reflected in Section 2.3. The comparison of the three algorithms of the test set and training set under 462 bands and 186 bands is shown in Figure 11, and the training set prediction results are represented in different legends to judge whether the training set is accurate with respect to the coverage degree of scattering and the true value, where the blue pentagram represents the true value label, and the blue dots, red dots, and green dots represent the training set prediction of the RF, SSA-RF, and JYSSA-RF models, respectively. The yellow, red, and green dots represent the test sets of the RF, SSA-RF, and JYSSA-RF models, respectively. To see the round-point coverage of the training set and test set more clearly, the full 462 bands were used as inputs; Table 4 shows the test set validation results and the accuracy of the three models for the full 462 bands. Table 5 shows the test set validation results and the accuracy of the three models with 186 bands as the inputs. For better identification To see the round-point coverage of the training set and test set more clearly, the full 462 bands were used as inputs; Table 4 shows the test set validation results and the accuracy of the three models for the full 462 bands. Table 5 shows the test set validation results and the accuracy of the three models with 186 bands as the inputs. For better identification of the procedure, A1, A2, A3, A4, and A5 are defined as 0, 1, 2, 3, and 4, respectively.

Application Validation
Fourteen grains were reselected from the healthy, mild, moderate, heavier, and heavy mildew groups. To verify the accuracy of the models, the comparison operation described in Section 2.4 was repeated. The results of the three models for 462 bands are shown in Table 6. The results of the three models for 186 bands are shown in Table 7. For better visualization of the predictive ability of the model, Figure 12 shows the visualization of the seed prediction and distinguishes it by different colors, where columns one and two represent A1 in blue, columns three and four represent A2 in cyan, columns five and six represent A3 in green, columns seven and eight represent A4 in yellow, and columns nine and ten represent A5 in red. (a) shows the true label value of the original image, while panels (b), (c), and (d) show the RF model, SSA-RF model, and the JYSSA-RF model, respectively, for the seed prediction under the full waveform. From the prediction images, the prediction effect for heavy mildew is not very good. Panels (e), (f), and (g) show the predictions of the three models under 186 bands, respectively, and it can be seen that the prediction effect for heavy mildew is significantly improved. low, and columns nine and ten represent A5 in red. (a) shows the true label value of the original image, while panels (b), (c), and (d) show the RF model, SSA-RF model, and the JYSSA-RF model, respectively, for the seed prediction under the full waveform. From the prediction images, the prediction effect for heavy mildew is not very good. Panels (e), (f), and (g) show the predictions of the three models under 186 bands, respectively, and it can be seen that the prediction effect for heavy mildew is significantly improved.

Discussion
Using the proposed algorithm, seeds with different degrees of mildew can be nondestructively tested for hyperspectral mildew. The reflectance value from seed hyperspectral imaging was obtained using a lightweight machine learning model suitable for subsequent transplantation to smartphones or other sensor devices. A faster SSA algorithm can be achieved using this method. The device is highly portable, highly efficient, and has a high level of precision.
While the algorithm achieved the required accuracy, it still needs to be improved. First and foremost, in terms of the SSA itself, although the improved SSA shows reasonable accuracy on the whole, there are ways in which the algorithm itself could be enhanced in terms of its accuracy and convergence speed, such as by using mathematical formulae, applying distributions, and introducing the concepts of sine and cosine, in order to further enhance the accuracy and convergence speed of the SSA. Additionally, the overall algorithm development framework is based on a single thread, from which subsequent multi-

Discussion
Using the proposed algorithm, seeds with different degrees of mildew can be nondestructively tested for hyperspectral mildew. The reflectance value from seed hyperspectral imaging was obtained using a lightweight machine learning model suitable for subsequent transplantation to smartphones or other sensor devices. A faster SSA algorithm can be achieved using this method. The device is highly portable, highly efficient, and has a high level of precision.
While the algorithm achieved the required accuracy, it still needs to be improved. First and foremost, in terms of the SSA itself, although the improved SSA shows reasonable accuracy on the whole, there are ways in which the algorithm itself could be enhanced in terms of its accuracy and convergence speed, such as by using mathematical formulae, applying distributions, and introducing the concepts of sine and cosine, in order to further enhance the accuracy and convergence speed of the SSA. Additionally, the overall algorithm development framework is based on a single thread, from which subsequent multi-threaded development can be carried out to increase the processing efficiency of hyperspectral images. Furthermore, although the images of the hyperspectral imaging system are preprocessed, its advantageous 3D superpixel information has not been used to further explore the algorithm in terms of its application in computer vision processing.

Conclusions
A hyperspectral imaging method was used to identify the types of mold growing on mold-covered maize seeds. As observed, the spectra of maize seeds with various molds showed substantial variation from one another, and the 500-700 nm reflectance of the spectrum became increasingly degraded with time. At 700-900 nm, an accurate representation of the level of maize seed mold could be found in the steady decline in the absorption process of the peak. There were two major results of this study: an improved SSA and an improved moldy seed prediction and classification algorithm.
Through the implementation of the elite reverse strategy, the SSA was enhanced, and the RF classification model was refined, improving the convergence speed of the optimized JYSSA method and increasing the accuracy of optimal solution judgment from 0.94 to 0.96.
The JYSSA-RF classification model is constructed after the feature band selection, and its accuracy is higher than that of the JYSSA-RF model under the full band, as well as that of the RF and SSA models, with strong prospects for practical applications.
To classify corn seeds with different degrees of mold, this study optimized an RF classifier based on hyperspectral imaging technology and an optimization algorithm. Furthermore, for the first time, the SSA was applied for nondestructive testing, with the potential to improve the characteristic bands and integrate them, along with their associated models, into the equipment in the future. This study presents additional prospects in the field of food security, where its applications could be more varied.
The SSA still needs further research, despite the idea of dividing elites into groups. Some improvements could be made in image preprocessing, image analysis, and identifying seeds with no mildew.
Our future research will not only improve the selection of classification models but also employ 3D superpixels as input sources. This will enable us to further explore the images and optimize the SSA. The wavelength characteristics of mildewed seeds will be further studied in the future.