# Identification of Hybrid Okra Seeds Based on Near-Infrared Hyperspectral Imaging Technology
## 2 Materials and Methods
### Multivariate Data Analysis  
Three different methods were used in the present study: principal component analysis (PCA), partial least squares discriminant analysis (PLS-DA), and support vector machine (SVM). Seed morphology was first used to explore the feasibility of seed classification of hybrid okra. PCA analysis was carried out to visually show the differences between different kinds of seeds by their average spectral characteristics. Since the full band spectrum contains a lot of redundant information,two methods of extracting the characteristic wavelengths were adopted in this study: successive projections algorithm (SPA) and competitive adaptive reweighted sampling (CARS). In addition to the 14 characteristic wavelengths extracted by SPA, CARS extracts 86 characteristic wavelengths--almost half of the total 200 bands. Thus, in order to reduce the number of characteristic wavelengths and to ensure the simplification of the models, SPA was used again to extract the characteristic wavelengths based on CARS. Next, the PLS-DA and SVM models that are based on the full spectrum and characteristic wavelengths were built. Finally, CARS-SPA-SVM combined with the image processing algorithm was used to draw the predicted pseudo-color map to show the classification results more intuitively. PCA is a commonly used and effective data reduction compression algorithm and it has been used in NIR spectroscopy identification [23]. Its basic principle is to convert multiple related variables in the original data into a new comprehensive variable (principal component) through linear transformation. The main components of the first few contributions in the new variable cover the main information of the original data. Therefore, this article preserves the first three principal components and compares three types of okra seeds by comparing the spatial distribution of the samples on three principal components. PLS-DA is a pattern recognition method that is widely used and classified by spectral data [24; 25]. In this paper, the spectral data of the sample was used as the independent variable X, the class number was used as the dependent variable Y, and the PLS-DA model was established in the Unscrambler X 10.1 by the retention one method, and the prediction set sample was predicted based on this classification model. According to the absolute value of the difference between the sequence number of the sample and the predicted value of the model, the discriminant accuracy of the modeling set, and the prediction set was calculated. As the N value had a decimal number, the set threshold was 0.5 in the actual calculation. The parameters of the model were determined by the sum of the predicted residual squares. SVM is a machine learning algorithm that is based on statistical learning Vapnik-Chervonenkis (VC) dimension theory and the structural risk minimization principle [26; 27]. It can be used for qualitative and quantitative analysis of data. SVM maps the input space into high-dimensional space through the kernel function; it constructs the optimal classification plane to separate the two classes accurately and correctly, and it introduces the penalty coefficient and the relaxation coefficient (c, g) to make the correction. This ensures that that the classification interval of the two classes is the largest and it thus ensures minimum risk. SVM is widely used in data classification and analysis. In this paper, the model set and prediction set of MATLAB 2013b are input, the SVM program to identify the species of okra seed is run, and radial basis function (RBF) is used as a kernel function of the SVM model. The optimal (c, g) parameter combination is determined by the grid search method in the range of 2-8 to 28 optimization, and the accuracy of the output model is identified. The quality of these classification models is evaluated by the classification recognition rate. If the predicted value obtained by these models is the same as the value that we have coded, we believe that the identification is correct.