Machine Learning for Seed Quality Classification: An Advanced Approach Using Merger Data from FT-NIR Spectroscopy and X-ray Imaging

Optical sensors combined with machine learning algorithms have led to significant advances in seed science. These advances have facilitated the development of robust approaches, providing decision-making support in the seed industry related to the marketing of seed lots. In this study, a novel approach for seed quality classification is presented. We developed classifier models using Fourier transform near-infrared (FT-NIR) spectroscopy and X-ray imaging techniques to predict seed germination and vigor. A forage grass (Urochloa brizantha) was used as a model species. FT-NIR spectroscopy data and radiographic images were obtained from individual seeds, and the models were created based on the following algorithms: linear discriminant analysis (LDA), partial least squares discriminant analysis (PLS-DA), random forest (RF), naive Bayes (NB), and support vector machine with radial basis (SVM-r) kernel. In the germination prediction, the models individually reached an accuracy of 82% using FT-NIR data, and 90% using X-ray data. For seed vigor, the models achieved 61% and 68% accuracy using FT-NIR and X-ray data, respectively. Combining the FT-NIR and X-ray data, the performance of the classification model reached an accuracy of 85% to predict germination, and 62% for seed vigor. Overall, the models developed using both NIR spectra and X-ray imaging data in machine learning algorithms are efficient in quickly, non-destructively, and accurately identifying the capacity of seed to germinate. The use of X-ray data and the LDA algorithm showed great potential to be used as a viable alternative to assist in the quality classification of U. brizantha seeds.


Introduction
Seed quality is an important factor in agricultural production, with a direct impact on yield [1]. In plant breeding, the use of high-quality seeds reduces costs of field experiments and increases the probability to identify a better crop variety. In the seed industry, quality assurance programs rely on numerous methods to certify seed quality attributes, such as germination and vigor tests [2]. These procedures have limitations related to time consumption, subjectivity, and the destructive nature

NIR Data Collection and Preprocessing
The absorbance data from each seed was measured using a Thermo Scientific Antaris II FT-NIR spectrometer with a spectral range from 1000 to 2500 nm, with each spectrum represented by an average of 32 scans measured with an 8 cm −1 resolution, resulting in 3112 channels. This instrument operates in an integrating sphere with a diffuse reflectance module and spectra were obtained in reflectance mode as log (1/R). It took approximately 30 s to obtain the spectrum of each seed.
We preprocessed the spectral data by removing the external noises using the "prospectr" package [21] in the R software [22]. A signal pretreatment was performed using autoscaling and first-order derivative transformation with Savitzky-Golay smoothing, followed by data binning (window = 10), which reduced the number of spectral bands from 3112 to 310. Data binning is a form of quantization of the spectral data, in which the original values are replaced by single central values to reduce the effect of noise during the spectrum acquisition [20].

X-Ray Imaging
Initially, the seeds were fixed on an adhesive paper in groups of 50 seeds. Then, radiographic images were generated using a Faxitron MX-20 device (Faxitron X-ray Corp, Wheeling, IL, USA). Seeds were exposed to radiation for 10 s with a voltage adjustment of 23 kV at a focal length of 41.6 cm. The contrast of the X-ray images was adjusted to optimize the visualization of internal seed tissues, and the images were saved in tagged image file format (TIFF).
We used the IJCropSeed tool to analyze the X-ray images [23]. This tool provided 17 descriptors related to the following seed morphometric characteristics: area, perimeter, circularity, width, height, feret, aspect ratio, roundness, solidity, relative density, integrated density, median gray level, skewness, kurtosis, internal free space, and seed filling (filling.1 and filling). The details on the descriptors can be found in Medeiros et al. [23].

Physiological Analysis
The seed germination rate and the time required to produce normal seedlings were evaluated. A normal seedling showed vigorous growth without any visible defects. The experiment was conducted using transparent plastic boxes (11.0 × 11.0 × 3.5 cm 3 ) with two blotting papers moistened with distilled water (1:2.5, g mL) placed inside the boxes [24]. The boxes were kept at daily temperature alternations (16 h at 15 • C and 8 h at 35 • C), and seed germination (root protrusion) was evaluated daily until 21 days after sowing.

Germination and Vigor Classes
Seeds were classified according to germination capacity (root protrusion at 21 days) and their vigor. Seed vigor was calculated based on germination speed (time required to generate a normal seedling). Subsequently, three seed classes were created: Class 1: non-germinated seeds; Class 2: rapid germination-normal seedlings produced within 9 days; Class 3: slow germination-normal seedlings produced later than 9 days. The period of 9 days was defined based on the accumulated germination curve, with approximately 71% of germinated seeds.

Machine Learning Methods
The FT-NIR and X-ray data were organized into two datasets and analyzed individually. Later, the variables of each technique were used to create another dataset combining information from the two techniques. Each dataset was arranged in an X matrix (predictors) and data from the germination test (seed classes) were arranged in the Y vector (response). The predictive models were created using five machine learning algorithms: LDA, PLS-DA, RF, NB, and SVM-r. Data analysis was performed by R software using the "caret" package [25]. The "caret" package was also used to calculate the most important predictor variables for the models, in which the variable importance was dimensioned to a maximum value of 100 and a minimum value of 0. The hyperparameters used in each model are shown in Table 1. Note: LDA-linear discriminant analysis; PLS-DA-partial least squares discriminant analysis; RF-random forest; NB-naive Bayes; SVM-r-support vector machine with radial basis kernel.

Model Validation
The training set comprised 60% of the data, and the remaining 40% were used to test the models. The model performance was evaluated through cross-validation (fold = 5), and the quality of predictions was measured based on overall accuracy, sensitivity, and specificity metrics obtained by the "caret" package.

Spectral Overview and Internal Seed Morphology
The raw NIR spectra are shown in Figure 1a. Since raw spectral data may present noise and compromise the analysis, data were preprocessed using autoscaling, first-order derivative transformation with Savitzky-Golay smoothing and data binning ( Figure 1b). This allowed for reducing the number of wavelengths from 3112 to 310, and establish predictive wavelengths to create the machine learning models for training. The mean spectra showed differences between classes of germination capacity for most bands, with alternating absorbance peaks between classes depending on the NIR region (Figure 1c), and a similar behavior was also shown between classes of vigor ( Figure 1d).

Machine Learning Models
We developed models for seed quality classification using X-ray image features and NIR data, individually or combined. The models were developed to predict seed germination capacity and seed vigor (speed to generate normal seedlings).

Germinated and Non-Germinated Seed Classification
The classes of germination capacity were unbalanced with 147 of germinated seeds and 58 of non-germinated seeds. In the testing set, the PLS-DA algorithm showed better performance for FT-NIR spectroscopy data, with 82% accuracy ( Table 2). This result indicates a great potential of the FT-NIR spectroscopy technique for classifying seed germination capacity. The model using X-ray data individually achieved high accuracy, from 84 to 90%, depending on the algorithm. Combining FT-NIR and X-ray data, the performance of the models improved in relation to the classification using only FT-NIR data; however, it remained the same or less compared to the classification using only Xray features. The RF model was highlighted with the merged data, with an accuracy of 85%. Overall, sensitivities below 74% and specificities above 82% were obtained. X-ray images of individual seeds were used to assess morphometric descriptors, including tissue integrity features (Figure 1e). Healthy seeds and seeds with embryonic malformation, mechanical damage, and deteriorated tissues were identified based on the grayscale values of the pixels in the images, which were directly associated with seed quality traits. In the colormap, hot and cold colors indicate high and low grayscale values, respectively (Figure 1e). Regions with higher grayscale values in the image represent lower penetration of the X-ray, which is directly associated with higher tissue density. Soft tissues, such as damaged tissues, show higher absorption of the X-ray beam as it passes through the tissue.
In this study, the importance of variables used to develop the models was calculated. Variable importance represents the statistical significance of each variable in the data set concerning its effect on the model generated [26]. For germination capacity, the PLS-DA (Figure 1f) and the LDA (Figure 1h) model revealed eleven wavelengths (1221,1902,2029,2037,2045,2230,2259,2289,2309, 2320, and 2351 nm) and six variables from X-ray images (relative density, integrated density, median gray level, kurtosis, filling.1, and internal free space), respectively, with greater contribution for the models (threshold >50%). For seed vigor, five wavelengths contributed more to the PLS-DA model (1889, 1902, 2289, 2309, 2259 nm) (Figure 1h), and two X-ray variables (relative density and median gray) reached a contribution greater than 50% (Figure 1i).

Machine Learning Models
We developed models for seed quality classification using X-ray image features and NIR data, individually or combined. The models were developed to predict seed germination capacity and seed vigor (speed to generate normal seedlings).

Germinated and Non-Germinated Seed Classification
The classes of germination capacity were unbalanced with 147 of germinated seeds and 58 of non-germinated seeds. In the testing set, the PLS-DA algorithm showed better performance for FT-NIR spectroscopy data, with 82% accuracy (Table 2). This result indicates a great potential of the FT-NIR spectroscopy technique for classifying seed germination capacity. The model using X-ray data individually achieved high accuracy, from 84 to 90%, depending on the algorithm. Combining FT-NIR and X-ray data, the performance of the models improved in relation to the classification using only FT-NIR data; however, it remained the same or less compared to the classification using only X-ray features. The RF model was highlighted with the merged data, with an accuracy of 85%. Overall, sensitivities below 74% and specificities above 82% were obtained. Table 2. Number of seeds correctly classified for germination capacity using descriptors generated by Fourier transform near-infrared (FT-NIR) spectroscopy, X-ray imaging, and the combination of FT-NIR spectroscopy and X-ray imaging. Note: LDA-linear discriminant analysis; PLS-DA-partial least squares discriminant analysis; RF-random forest; NB-naive Bayes; and SVM-r-support vector machine with radial basis kernel.

Seed Vigor Classification
Predictions for seed vigor reached lower accuracy (43-68%) for all algorithms ( Table 3). The classifiers developed using the FT-NIR data individually achieved lower accuracy (<61%) with lower sensitivity (<55%) and specificity (<79%). On the other hand, the model showed better performance with the X-ray data, reaching 68% accuracy in the test set via PLS-DA, and 64% accuracy in the cross-validation via SVM-r. FT-NIR combined with X-ray data had an intermediate performance for seed vigor classification. The best result was obtained with the RF algorithm (59% and 62% accuracy, for cross-validation and testing, respectively). Table 3. Number of seeds correctly classified for different vigor classes using descriptors generated by Fourier transform near-infrared (FT-NIR) spectroscopy, X-ray imaging, and the combination of FT-NIR spectroscopy and X-ray imaging.

Discussion
The use of optical sensors to identify spectral and physical properties of seeds has contributed to quickly, accurately, and non-destructively obtaining valuable chemical and structural information related to seed performance. Although this technology is effective in solving problems in many fields, there is still a demand for non-destructive, fast, accurate, and online predictive methods for assessing seed quality by the seed industry [2]. In this study, we presented a new methodology based on merged data to predict germination capacity and seed vigor using FT-NIR and X-ray images, which was validated using seeds of U. brizantha.
Our results showed high accuracy of the models developed to classify seeds according to their germination capacity, and moderate performance for predicting seed vigor. The models developed using X-ray data achieved the highest precision, with an accuracy of 0.90 for germination and 0.68 for vigor prediction via the LDA and PLS-DA algorithms, respectively. The variables related to tissue density had the most contribution to seed quality classification. This fact reveals the direct relationship between physical characteristics of seeds (tissue integrity) and their physiological quality.
Differences in tissue densities in radiographic images are associated with morphological alterations and anatomical properties [6]. The relationship between tissue density parameters and seed germination was also reported for other species, indicating that X-ray imaging has great potential to be employed for seed quality classification [7,27,28]. Nevertheless, since X-ray images only show the physical state of an object, caution is necessary when using this technique, as seeds are living and complex organisms influenced by many factors [5]. Consequently, this relationship may not always be detected using only the X-ray technique [6].
The use of NIR spectroscopy methods combined with X-ray imaging can provide both seed chemical composition and physical integrity measurements [10,[14][15][16][17]. The NIR spectra comprise bands of higher wavelengths arising from overlapping absorptions corresponding to chemistry bond combinations such as C-H, O-H, and N-H [3]. The spectral bands that had greater contribution to classify the germination capacity of U. brizantha seeds were 1221, 1902, 2029, 2037, 2045, 2230, 2259, 2289, 2309, 2320, 2351 nm. The chemical compounds related to these wavelengths are amino acids, carbohydrates (cellulose, hemicellulose, pectic polysaccharides, pyranose compounds, starch, and sucrose) and nucleic acids [11,13,25,29,30]. Using the NIR data, the best algorithm to classify the seed germination capacity was PLS-DA, reaching an accuracy of 82%. In previous studies, the use of FT-NIR showed higher accuracy (90-100%) for seed viability classification using the PLS-DA algorithm [9,10,12]. However, it is important to mention that this is a pioneering study with the application of NIR for U. brizantha seed analysis. Therefore, further research is needed to elucidate the lower performance achieved, which may be related to the seed characteristics (e.g., presence of palea and lemma, greater amount of dead tissue-endosperm, and reduced embryo size).
The use and combination of different techniques have gradually increased in seed technology, especially for detecting seed viability [12,[31][32][33][34][35]. Combinations based on merged data have shown the potential to increase reliability on seed classification when compared to the use of individual analytical techniques [3,19]. In the present study, we combined information from both FT-NIR and X-ray techniques into five machine learning models in order to find the best classifier. The model achieved an accuracy of 85% with the RF algorithm to predict the seed germination capacity. In total, 310 variables from FT-NIR, and 17 variables from X-ray imaging were used. Conversely, we did not have similar results for seed vigor prediction, where the models showed less accuracy (<62%).
The lower accuracy of the models developed for seed vigor classification may be associated with the complexity of seed behavior, which is also influenced by environmental conditions [1]. For instance, our model distinguished class 2 (rapid germination) from class 1 (non-germinated seeds), but not from class 3 (slow germination) (Figure 2a). Interestingly, seeds with soft mechanical damages in the embryonic axis (Figure 2b) were not identified by the model as non-germinated seeds (class 1); instead, they were erroneously classified as class 2 or 3.

Conclusions
This study investigated the combination of FT-NIR spectroscopy and X-ray imaging to predict seed quality traits (germination and vigor). The proposed approach is sensitive to obtain information on the capacity of seeds to germinate (85% accuracy). On the other hand, it was not possible to reliably We selected three seeds of each class and presented their spectra and 3D projection of X-ray images based on grayscale to simplify the relationship between the methods tested in this paper. We observed differences among classes for absorbance values across the spectrum (Figure 2c) and grayscale values in the X-ray images (Figure 2d), which directly affected seed performance (Figure 2d).
Our findings showed that the model built with the X-ray dataset has higher accuracy for seed quality classification using the LDA algorithm. Additionally, when X-ray data were combined with FT-NIR data, the model also showed high performance. These results point out new perspectives to combine two sensors as a powerful tool for predicting seed quality, e.g., while FT-NIR can provide information on chemical composition, the X-ray images give information on the tissue integrity. However, despite this combination being an interesting approach, the results obtained with this work highlighted the X-ray technique as the most reasonable option to analyze the seeds, considering the high precision achieved in the models. Although our models are specific for U. brizantha seeds, the methodology proposed can be widely applied for other species. To the best of our knowledge, this is the first attempt to combine FT-NIR and X-ray imaging data to predict seed quality using machine learning models, and our findings can be a guide for the development of in-depth studies.

Conclusions
This study investigated the combination of FT-NIR spectroscopy and X-ray imaging to predict seed quality traits (germination and vigor). The proposed approach is sensitive to obtain information on the capacity of seeds to germinate (85% accuracy). On the other hand, it was not possible to reliably estimate the seed vigor (62% accuracy). The method can be an alternative to rapid, non-destructive, and accurate classification of seed quality by merging FT-NIR spectroscopy and X-ray imaging data. Regarding the application of the techniques individually, the X-ray approach was highlighted as the most viable option, as it does not need data preprocessing and deals with fewer variables than FT-NIR, resulting in less time and complexity for this analysis.

Conflicts of Interest:
The authors declare no conflict of interest.