# Snapshot-Based Multispectral Imaging for Heat Stress Detection in Southern-Type Garlic
## 2 Materials and Methods
### Data Analysis  
Various vegetation indices have been used for decades as indicators to assess the growth status of crops. In this study, the NDVI (Normalized Difference Vegetation Index), Red Edge Ratio, and PRI (Photochemical Reflectance Index) vegetation indices were used  
Figure 2: (**a**) Example of raw Vis snapshot image pixel component (**b**) Example of raw NIR snapshot image pixel component. to compare the results with the PLS-DA, LS-SVM, DNN, and RP-CNN models developed using multispectral imaging. The vegetation index was calculated using Equations (1)-(3) as follows:  
\[\mathrm{NDVI}=\frac{\rho_{\mathrm{nir}}-\rho_{\mathrm{red}}}{\rho_{\mathrm{nir}}+ \rho_{\mathrm{red}}} \tag{1}\]  
\[\mathrm{Red~{}Edge~{}Ratio}=\frac{\rho_{\mathrm{nir}}}{\rho_{\mathrm{red}}} \tag{2}\]  
\[\mathrm{PRI}=\frac{\rho_{\mathrm{green}}-\rho_{\mathrm{red}}}{\rho_{\mathrm{ green}}+\rho_{\mathrm{yellow}}} \tag{3}\]  
PLS-DA is a widely used multivariate statistical technique for classification tasks. It combines the principles of principal component analysis (PCA) and linear regression. By decomposing the spectral data into latent variables known as components, PLS-DA maximizes the covariance between the predictor variables (spectral data) and the response variable (class labels). The number of components is typically determined using cross-validation or other model selection techniques. The PLS-DA algorithm constructs a discriminant model by fitting a linear regression between the components and the class labels [34; 35; 36]. LS-SVM, on the other hand, is a variant of support vector machines that employs least squares optimization instead of quadratic programming. LS-SVM is particularly useful for handling nonlinear data. By transforming the spectral data into a higher-dimensional space called the feature space, LS-SVM seeks to find an optimal decision boundary on a hyperplane that maximizes the margin between different classes. The algorithm solves a set of linear equations using the least squares method to determine the hyperplane parameters [37; 38; 39]. DNN, a deep learning method, has shown significant success in various domains, including spectral data analysis. DNNs consist of multiple hidden layers between the input and output layers, enabling them to learn complex patterns and relationships in the data. In our study, the DNN architecture employed an input layer, hidden layer 1, hidden layer 2, and an output layer, as depicted in Figure 3. The hidden layers utilized techniques such as Leaky ReLU activation and channel merging to improve the network's training performance. The DNN model was trained using labeled spectral data, adjusting the weights of the neurons through optimization algorithms like the stochastic gradient descent [40]. The former generates two groups, while the latter produces three groups. Figure 3: (**a**) Two-group DNN diagram (**b**) Three-group DNN diagram. RP-CNN represents a specialized variant of convolutional neural networks (CNNs) that incorporates random projections. Prior to inputting the spectral data into the convolutional layers, random projections are applied, reducing dimensionality while preserving important properties. RP (recurrence plot) represents one-dimensional (1D) data as an image, as illustrated in Figure 4. RP is created by determining the two-dimensional (2D) spatial trajectory of the spectral data and then constructing a distance matrix using Equation (4) [44]. \[\mathrm{R_{ij}}=\theta\Big{(}e-\left\|\overrightarrow{\mathrm{s_{i}}}- \overrightarrow{\mathrm{s_{j}}}\right\|\Big{)} \tag{4}\]  
A CNN (convolutional neural network) is a deep learning method that involves convolutional, nonlinear activation, and pooling processes [41; 42]. The layer structure of the CNN is depicted in Figure 5, comprising the input layer, hidden layer 1, hidden layer 2, hidden layer 3, and output layer. When spectral data is input to the network, the number of channels increases. Batch Norm, Leaky ReLU, and Max Pooling are applied in hidden layer 1 and hidden layer 2.