Using Supervised Classification Methods for the Analysis of Multi-spectral Signatures of Rice Varieties in Panama

Article history: Received: 25 December, 2020 Accepted: 08 March, 2021 Online: 17 March, 2021


Introduction
The electromagnetic spectrum interacts with matter in a balanced relationship that indicates that the light reaching a body will be proportional to the light that is transmitted (measured through transmittance), absorbed (measured through absorbance) and reflected (measured through reflectance) in the body per in a unit of time. These measurements provide a signal that can be plotted, thus visually showing the relationship between the incident and reflected radiation flux.
These measurements are generally called spectral fingerprints or spectral signatures. Their measurement in agricultural crops is of special interest in precision agriculture, since they can provide a look into the crop health and phenological state. This information allows to determine how acceptable are the growth and development of the crop at a given planting stage.
This paper is an extension of the work originally presented in the 2019 XLV Latin American Computing Conference (CLEI) [1]. It will address other ML methods to achieve supervised classification of rice spectral signatures in Panama.
Supervised classification Machine Learning (ML) methods, such as Artificial Neural Networks (ANN), are commonly used for the analysis of Near-Infrared (NIR) spectral signatures [2]- [3]. ANN allow a way to identify relevant characteristics from a set of inputs (in this case spectral signal) and map them to corresponding output targets (physical or logical values associated with the object of under study). The model is learned through weight adjustments between connected units, called neurons, which are arranged in different layers. ANN are well regarded method. Especially in agriculture to determine quality parameters [4]- [5]. Deep neural networks (DNNs), on the other hand a widely used in NIR spectral analysis [6]- [7]. DNNs are basically ANN with a vast number of hidden layers, which allow them to learn complex mapping relationships between inputs and outputs [8,9].
Other ML methods rely on tree structures that partitions sample groups and the data set of features in order understand the relationship between labelled samples. Among these methods the most notable are: Decision Trees (DT) [10,11] and Classification and Regression Trees (CART) and Random Forest (RF) [12]. The latter being of special interest since it is suited to understand massive data sets, by aggregating/averaging decision trees [13]. As ANNs and DNNs, tree based methods have been used to understand the relationships between sets of NIR spectra [14]- [15].
The objectives of this study are twofold: 1) Explore methods for the classification of spectral signatures of rice varieties, using networks and tree based algorithms; 2) Be able to train/test/validate a model that relates to field acquired spectral signatures with satellite signatures. The rest of this article is structured as follows: Section 2, presents the spectral database and the algorithms used for the classification. Section 3, shows the results obtained and discusses the implications to the model characterization. Section 4, provides overall conclusions of the article and focuses on suggesting future work that could be used as starting point for upcoming analysis.

Spectral Database
As described in [1], the spectral signatures were collected on-site from 3 different plots locations using a portable Spectroradiometer. The raw measurements were organized into a database consisting of signatures in the 350 nm to 1050 nm wavelength range (447 wavelengths points per signature). For each one of these 1453 signatures the database also contained information about the plot management, including crop variety, and more importantly days after planting (DAP), at which the spectral signature was collected.
The most prominent crop in the database is rice with 1348 signatures, with onion and pimento having less than 60 signatures, and other crops such as tomato, and maize having less than 15 signatures in total. Three local varieties of rice were more prominent in the plots: IDIAP-38, IDIAP 52-05 and FL137-11, the first two being experimental varieties from the Instituto de Investigaciones Agroindustriales de Panama (IDIAP), while the latter being a commercial variety.
Spectral signatures were normalized using unit variance scaling. Later, the total number of wavelengths (spectral features), was reduced from the original 447 dimensions by using Principal Components Analysis (PCA). Only the first 100 components were kept for each signature.

Satellite Derived Spectral Signature Database
This study made use of satellite images from PlanetScope, as a source of external signatures and among other reasons for models validation. The exact polygons, where field spectral signatures were acquired, were treated as a source for spectral signatures.
A successful comparison between the spectral signatures and their satellite derived counterpart was made by normalizing matching dates (or closest days available) in which there were also field measurements and by integrating (summarize) the reflectance values obtained in the field into the satellite 4 band format, as follows: blue (455 -515 nm), green (500 -590 nm), red (590 -670 nm), and infrared (780 -860 nm). Finally, all the satellite derived spectral signatures were organized into a database for later use.

Regression and Supervised Classification of Spectral Signatures
Since one of the goals of this study was to find a model capable of predicting the days after planting (DAP), just by using the spectral signatures two families of models were selected. The first being a (continuous) regression models family in which the targets were numerical values representing the DAP. The second being a (discrete) binary classification model family, which makes possible to make rice predictions from non-rice related signatures, coded as 0 and 1, Three regression models were tested to predict the DAP of the signatures: 1. Multilayer Perceptron Regressor (MLPR)

Random Forest Regression (RFR)
Two classification models were test to predict the rice and nonrice:

Random Forest Classification (RFC).
In all models, spectral signatures were divided as 70% and 30% for training and testing purposes, respectively.

Cost functions and Evaluation Metrics
Two cost functions were compared for all models, the Mean Square Error -MSE (1), and the Mean Absolute Error -MAE (2). Two measures were used to evaluate the performance of all models, the Root Mean Square Error -RMSE (3), and the coefficient of determination, also known as: R-squared -R 2 (4).
For binary classification models, evaluation of their performance was made via a different set of metrics. Generally, the performance www.astesj.com 553 of these models are tied to the model capacity to provide true predictions: true positive (TP) and true negative (TN), but also, prediction errors or false prediction is accounted via: false positive (FP) and false negative (FN). These counts are organized into a confusion matrix, shown in Table 1.

Software Implementation
All plots were made using matplotlib. Database normalization, dimensionality reduction, regressions and classification methods and their errors were implemented using the Scikit-Learn library in Python [16]. The trees structures generated by Decision Tree and Random Forest algorithms were plotted using graphviz (https://graphviz.readthedocs.io/). Figure 1 shows the complete set of reflectance spectral signatures present in the database. Figure 2 shows the reflectance spectral response of the local varieties for the Juan Hombron plot. Figure 2A, shows the spectral signal variation of the FL137-11 material, from 48 to 116 DAP. Figure 2B, shows the variation of the IDIAP-38 material in 13 and 19 DAP, and also the variation of the IDIAP 52-05 material from 13 to 116 DAP. In all cases, the spectral signature has less variation in the visible range (400-700 nm) and more activity in the near-infrared part of the spectrum (700-100 nm) as the DAP increases.

Regression Models applied to Rice Spectral Signatures
The Multilayer Perceptron Regressor network was set up to have 500 neurons in the hidden layer, tolerance of 1e −4 and using as ADAM as optimizer. For the Decision Tree Regressor, MSE was set to be the criterion, and the default settings were followed. The Random Forest Regressor was set up to build 50 trees (estimators), as in in the Decision tree, the default settings were followed. Error metrics for the three algorithms are shown in Table 2. The MLPR model achieved the higher R 2 with 0.92 and the lower RMSE values with 8.78. The two tree based regression models showed to behave similarly with R 2 of 0.56 and 0.57, respectively. Also, having RMSE values of around 19, in both cases. Figure 4 shows the loss curve per iterations for the MLPR model, with a final loss of 0.08. The network training was stopped after 1492 iterations and resulted in an overall MLP training score of 0.99.

Classification Models applied to Rice Spectral Signatures
The Multilayer Perceptron Classifier network was set up to have 200 neurons in the hidden layer, tolerance of 1e −4 and using ReLU as an activation function. As for the Random Forest Classifier was set up to build 50 trees (estimators), here also, the default settings were followed. Error metrics for the two algorithms are shown in Table 3. The MLPC model achieved a better R 2 than the RFC, with a value of 0.94 and the lower RMSE of the two with a value of 0.006. The two algorithms perform in the 90% having accuracy values of 0.99 and 0.96, respectively. Also having high F1 scores, with values of 0.99 and 0.97, respectively. Figure 5 shows the loss curve per iterations for the MLPC model, with a final loss of 0.006, after 166 iterations.  Figure 6 shows the final tree structure of the RFC. In warmer colors it shows the statistically significant decision nodes. In general, the RFC models were not as accurate as MLPC models, but they help us determine the most relevant wavelengths for classification, Table 4 provides a list of the Top-5 wavelengths that could be used as to classify the signatures. Interestingly, all these wavelengths are in the visible range between 400 and 600 nm.
A partial conclusions that can be addressed is that when predicting the DAP from the spectral signatures, it is very important to reduce the parameters to increase the precision of the model. It is important to notice that also, that when classifying crops (rice or other), there was no need to apply PCA since the model is quite accurate and has fewer losses. It even starts at a loss value of 0.4, close enough to 0, in the first iterations, as shown in Figure 5. www.astesj.com 555

Regression and Classification of Satellite Derived Signatures
The database for this experiment was comprised of the satellite spectral signatures and also the field (on site) spectral signals. The satellite spectral signatures are the ones compared using the Spectral Angle Mapper (SAM) method, as described in [1]. As for the (on site) spectral signals they had to be integrated to four wavelength bands that are used to represent satellite images. Table 5, shows the distribution of the spectral signature in the expanded database, with both spectral signatures collected on site and from the satellite image. A neural network model capable of distinguishing between the rice, and not-rice (namely, forest and road satellite signatures) was trained using a Multilayer Perceptron Classifier. The network was set up to have 600 neurons in the hidden layer, tolerance of 1e −4 and using ReLU as an activation function. Figure 7A shows the loss curve for the MLPC model, having a final loss value of 0.11 after 733 iterations. Subsequently, a model was trained with the field spectral signatures reduced to 4 bands and the satellite spectral signatures. The field collected spectral signatures were used for training and testing (calibration), while the satellite spectral signatures were used for validation of the model. A Multilayer Perceptron Regressor was used. The network was set up to have 1000 neurons in the hidden layer, tolerance of 1e −4 and using as ADAM as optimizer.  Figure 7A shows the loss curve for the MLPC model, having a final loss value of 0.11 after 733 iterations. Figure 7B shows the loss curve of the MLPR model, it had final loss value of 23.74 after 2884 iterations.
As it is shown in Table 6, the MLPR model achieved the highest R 2 with 0.88 and an overall score of 0.90. However, the MLPC model had a lower RMSE value with 0.216. A result from this subsection is that when validating the model to predict days after planting , the error is still quite large. It might be possible to make it lower by having a larger amount of field spectral signatures, since this would give more information to the model longer learning time .

Conclusions
The aim of this work was to be able to train supervised classification Machine Learning models in order to further understand rice reflectance signatures. A database of spectral signatures collected using a portable spectroradiometer and a set of satellite image derived signatures were employed as input for these models. As output or targets for the training of these models, few variables were www.astesj.com used, among them: days after planting (DAP), and the possibility of distinguishing rice from other crops or from other geographical features.
In order to develop these regression and classification models, neural network based algorithms (Multilayer Perceptrons) and tree based algorithms (decision trees and random forest), were used.
For both cases, regression and classification of rice spectral signatures, the use of Multilayer Perceptron models are recommended. Our results suggest that MLPR is the best method to make a model able to regress on the DAP just from the spectral signatures. For the classification of rice and non-rice signatures MLPC was one again the best resulting method. The tree based models, although providing less useful models, were able t suggest a list of most relevant predictors and a visualization of their results. It seems that the most useful wavelengths to build this models are found mostly in the 500-600 nm wavelength range, which corresponds to the green and yellow colors of the visible spectrum. These wavelengths are in line to changes in the panicle, as described by Serrano et al. [17].
For the work on satellite derived signatures both MLPC and MLPR show interesting results over 0.7 and 0.88, respectively. However, the error metrics on the MLPR model are quite large. A large error that can be attributed to normalization effect between satellite and on site measurements, and total reflectance correction that exist between both spectral signatures. Suggesting that more samples should be added to the model to produce a more robust model.
One of the limitations of this study was the relatively small size of the database of spectral signatures employed. It is known that Machine Learning algorithms need more samples in order to have robust results. The need of more spectral signatures is evident by the poor generalization obtained, especially for the validation of satellite derived spectral signals.
For future work, few changes to the approach employed should be done. For instance, having different percentages in the training and testing splits. This work shows results only with 70%/30% split. It could be beneficial to test the limit of prediction by changing the percentages and/or using cross-validation techniques. Second, a class imbalance is evident in the spectral database, due to the focus on rice signatures by the original objective , leaving other crops or other spectral signatures astray. In order to make this database more balanced pseudo replicates need to be made from the non-rice signatures. Wang et al. in [18] presents an interesting approach for feature selection and replication using Variational Auto-Encoder (VAE) type of network, that could be pursued. Also in this line, Bjerrum et al. presents a complete framework for Data Augmentation (DA) approach for convolutional neural network (CNN) based deep learning chemometrics [19], that seems worth exploring for this application. Third, recent literature shows a shift from deriving spectral signals from satellite images, to working directly over the Hyperspectral images (HSI) [20]. Even using deep learning frameworks for identifying soil characteristics [21], rice varieties [22], rice phenology [23], and even focusing on data imbalance in the image of domain [24].
The value of this work rest about on the fact that it presents a practical example of using supervised classification algorithms for the determination of regression and classification models from reflectance spectral signatures of a local crop. This study provides a basis for future works in deep learning based on chemometrics, and in particular the possibility of predicting crop conditions and characteristics from spectral signatures or satellite images.

Conflict of Interest
The authors declare no conflict of interest.