Predicting Canopy Nitrogen Content in Citrus-Trees Using Random Forest Algorithm Associated to Spectral Vegetation Indices from UAV-Imagery

: The traditional method of measuring nitrogen content in plants is a time-consuming and labor-intensive task. Spectral vegetation indices extracted from unmanned aerial vehicle (UAV) images and machine learning algorithms have been proved e ﬀ ective in assisting nutritional analysis in plants. Still, this analysis has not considered the combination of spectral indices and machine learning algorithms to predict nitrogen in tree-canopy structures. This paper proposes a new framework to infer the nitrogen content in citrus-tree at a canopy-level using spectral vegetation indices processed with the random forest algorithm. A total of 33 spectral indices were estimated from multispectral images acquired with a UAV-based sensor. Leaf samples were gathered from di ﬀ erent planting-ﬁelds and the leaf nitrogen content (LNC) was measured in the laboratory, and later converted into the canopy nitrogen content (CNC). To evaluate the robustness of the proposed framework, we compared it with other machine learning algorithms. We used 33,600 citrus trees to evaluate the performance of the machine learning models. The random forest algorithm had higher performance in predicting CNC than all models tested, reaching an R 2 of 0.90, MAE of 0.341 g · kg − 1 and MSE of 0.307 g · kg − 1 . We demonstrated that our approach is able to reduce the need for chemical analysis of the leaf tissue and optimizes citrus orchard CNC monitoring.


Introduction
Remote sensing of agricultural fields is important to assist its management through a low-cost and non-destructive approach.The usage of remote sensing systems supports data acquisition in a more frequent and faster manner, being more valuable to evaluate plants than most traditional agronomic procedures [1,2].In the nutritional analysis, different remote sensing techniques were evaluated recently [3][4][5][6][7].Regardless of the conducted approach, the spectral analysis of the vegetation is viewed as a reasonable alternative to estimate plant health conditions.
One important issue to correctly manage agricultural fields is to know the nitrogen (N 2 ) content in plants.N 2 is one of the main nutrients required for foliar development and photosynthetic activity, influencing plant productivity [7].However, applications of excessive amounts of fertilization in agricultural fields are still a common but erroneous practice [8].This practice negatively impacts plants, provoking their intoxication, and the environment through the leaching and the volatilization processes of the non-absorbed part [9].Consistent monitoring of the nutrient in leaf-tissue is essential to improve the management of crops and orchards.
The traditional agronomic methods to determine N 2 rely on the chemical analysis of the leaf-tissue.Those methods are normally labor-intensive, time-consuming, and highly costly and they produce environmentally dangerous residuals [10].As a non-destructive, clean and fast approach, remote sensing data like multispectral imagery obtained from unmanned aerial vehicles (UAV)-based sensors are often being used to monitor the nitrogen content in plants [11,12].The wide market availability of UAV, the high-spatial-resolution and the potential of multispectral imagery are some of the reasons behind it [13].Yet, because of the amount of data produced, remote sensing techniques in combination with high-resolution images are requiring more robust techniques to be evaluated.
Recently, machine learning algorithms have been used for different remote sensing applications [14][15][16][17][18]. Algorithms like artificial neural networks (ANN), support vector machine (SVM), decision trees (DT), random forests (RF), and others are powerful tools in assisting in UAV-based image analysis [19].These algorithms performed quite well in current approaches involving plant conditions such as nutritional status [20], water-quantity [21], biomass [19], and chlorophyll content [22].These studies have also considered the contribution of individual bands and spectral vegetation indices in their evaluations.
To estimate N 2 in plants, many studies evaluated the potential of spectral vegetation indices in crops such as wheat, maize, rice, corn, and others [12,[23][24][25][26].They can be applied at different scales, such as leaf or canopy level [27] and mitigate anisotropy effects, background shadows, and soil brightness contributions [27][28][29].Nevertheless, these advantages over individual spectral bands have yet to be further explored with machine learning algorithms.
Combining machine learning algorithms with spectral vegetation indices is a fairly new practice since these algorithms ensure good performance even with several variables as input features [20].As the spectral indices are generally simple to be computed and may reduce interference from other non-plant surface targets, they can be considered a feasible practice into measuring N 2 in tree-canopy scales.Agricultural fields such as citrus orchards may benefit from this type of analysis, as spectral indices are known to mitigate anisotropic effects from the tree-canopies.
In citrus plants, few studies evaluated the canopy nitrogen content (CNC) with remotely sensed data, and no study was found, up to the moment, involving the use of spectral indices with machine learning models.Since machine learning models can use additional information obtained directly from spectral indices, our hypothesis is that this combined information may result in an interesting outcome for the N 2 prediction in tree-canopy structures.Although machine learning algorithms have been employed in the leaf nitrogen content (LNC) analysis, there are still few studies that have incorporated a large dataset of spectral indices into their data-set.To the best of our knowledge, these have not been evaluated at a canopy-structure level.
In this paper, we propose a new framework to infer nitrogen content in citrus-tree at a canopy level using spectral vegetation indices calculated from UAV-imagery and the RF algorithm.First, we investigate the individual spectral indices performances and their relation to the CNC.Second, we combined the spectral indices into an RF model and evaluated its performance.We compared the proposed framework with other machine learning methods to prove the robustness of our approach.This paper is organized as follows: Section 2 presents related works.Section 3 describes the method employed in the analysis.Sections 4 and 5 present and discuss the results, respectively.Finally, Section 6 concludes this research.

Related Work
With the high availability of UAVs, the evaluation of nutritional condition in plants with high-spatial-resolution images has turned into common practice.Often used statistical methods like the principal component analysis (PCA), partial least square regression (PLSE), stepwise multiple linear regression (SMLR), and others were already implemented in the nitrogen content analysis [30,31].However, these methods presented different predictions accuracies in this task.This demands for more robust and intelligent algorithms, such as machine learning models.The use of machine learning into predicting nitrogen content is fairly new in remote sensing applications and already presented interesting findings.Though, none incorporated these models to evaluate nitrogen content at a canopy-level.
Regarding the LNC assessment, a study [32] calculated the nitrogen nutrition index (NNI) and evaluated it with machine learning models using RGB images.The authors used a potted pakchoi experiment in a greenhouse and compared the performance of different algorithms in two different stages.Random forest presented the best overall performance, reaching prediction accuracies of 0.82 and 0.94 in the seedling and harvest stages, respectively.Another study [33] evaluated LNC prediction in EO-1 Hyperion hyperspectral data and reached an R 2 of 0.67 for LNC in sugar-cane using the RF model.
The practice of combining several spectral vegetation indices with machine learning models is unusual.To estimate LNC, up until now, only two studies achieved this task, and both concluded that the RF model is a valid approach [20,34].The first study [34] used 26 spectral indices of WorldView-2 images as input features into an RF model.In this study, red-edge based vegetation indices were the most significant variables for predicting LNC, and their combination with the algorithm returned an R 2 of 0.89 for grass LNC.The second study [20] evaluated LNC in wheat crops with 19 spectral vegetation indices derived from hyperspectral UAV-based images.First-derivative indices were better related to LNC and predicted it with an R 2 of 0.72 using the RF model.
In citrus plants, until this moment, no machine learning model was implemented to predict CNC.Still, one approximation was conducted with hyperspectral measurements in orange-leaves [31].The authors applied a PLSR in a 350 to 2500 nm spectrum and discovered that the 448, 669, 719, 1377, 1773, and 2231 nm wavelengths were better correlated with LNC, and returned an R 2 of 0.83 and an RMSE of 0.122% for the validation dataset.In UAV-based images, a past study evaluated the performance of PLSR into predicting LNC and returned an R 2 of 0.647 [35].The authors, however, indicated that new approaches should be conducted to improve the LNC prediction in citrus-trees trough UAV images.
In a previous study, we used spectral wavelengths recorded with a field spectroradiometer to classify a UAV-image with different spectral algorithms [36].This study was conducted in the same experimental area as the study presented here and returned a classification accuracy of 85.7% and a kappa index of 0.75 for the spectral angle mapper (SAM) algorithm.Still, this method only returned a classified map with three N 2 classes (low, medium, and high), not being suitable to produce more detailed information.This approach also needed a field spectroradiometer to construct the spectral library used by the algorithm, which discourages its replication by low-budget models.
The use of spectral vegetation indices, derived from UAV-images, in conjunction with machine learning algorithms, has yet to be explored in the evaluation of tree-canopies such as citrus orchards.The random forest learner already demonstrates high potentials to predict LNC in other crops, and it indicated what spectral indices better contributed to its performance.Though, no machine learning method is universally appropriate, requiring comparison against others in order to test its robustness.For that, we present a methodological approach to consider the usage of the random forest algorithm into prediction CNC in citrus-trees at a canopy-level based on spectral vegetation indices data.

Materials and Method
The proposed method consisted of three phases (Figure 1).Phase 1 describes the survey method performed to collect field data from a Valencia-orange orchard.Here we acquired aerial images with a multispectral Parrot Sequoia camera embedded in a UAV platform and collected leaf samples in the experimental area.Phase 2 focuses on image processing procedures.They were conducted in commercial software named Pix4DMapper, and sampling points were created in a geographical information system (GIS) environment with the open-source software QGIS 3.4.Phase 3 was separated into two stages.Primarily, we selected the available spectral indices for the Parrot Sequoia bands and compared the CNC with them.After that, we used these spectral indices as input parameters for our RF approach and evaluated it with a cross-validation method.

Materials and Method
The proposed method consisted of three phases (Figure 1).Phase 1 describes the survey method performed to collect field data from a Valencia-orange orchard.Here we acquired aerial images with a multispectral Parrot Sequoia camera embedded in a UAV platform and collected leaf samples in the experimental area.Phase 2 focuses on image processing procedures.They were conducted in commercial software named Pix4DMapper, and sampling points were created in a geographical information system (GIS) environment with the open-source software QGIS 3.4.Phase 3 was separated into two stages.Primarily, we selected the available spectral indices for the Parrot Sequoia bands and compared the CNC with them.After that, we used these spectral indices as input parameters for our RF approach and evaluated it with a cross-validation method.

Data Survey
The study was conducted in a commercial orchard of Valencia orange (Citrus sinensis Valencia) trees planted on a Citrumelo swingle rootstock.The trees had reached their maturation stages at the period of the survey, with 5 years from their initial planting.The survey was carried out on 22 March 2018, when the plants were in their vegetative phase.The experiment was conducted in an area of 71.4 ha divided into 24 field-plots containing 752 plants per hectare, at 7 m × 1.9 m spacing (Figure 2).The area was previously fertilized with 250 kg.ha −1 of saturated nitrogen in ammonium nitrate.

Data Survey
The study was conducted in a commercial orchard of Valencia orange (Citrus sinensis Valencia) trees planted on a Citrumelo swingle rootstock.The trees had reached their maturation stages at the period of the survey, with 5 years from their initial planting.The survey was carried out on 22 March 2018, when the plants were in their vegetative phase.The experiment was conducted in an area of 71.4 ha divided into 24 field-plots containing 752 plants per hectare, at 7 m × 1.9 m spacing (Figure 2).The area was previously fertilized with 250 kg.ha −1 of saturated nitrogen in ammonium nitrate.The flight was conducted between 13:00 and 14:00.(local time), at 120 m high, resulting in a 12.9 cm ground sample distance (GSD) image.An eBee SenseFly UAV equipped with the Parrot Sequoia camera was used.This camera records images in the following spectral regions: green (530-570 nm), red (640-680 nm), red-edge (730-740 nm), and near-infrared (770-810 nm).Before the flight, a calibration plaque unique for the Sequoia equipment was recorded with the Parrot Sequoia camera to normalize the local illumination.The main characteristics of the UAV-mounted sensor used are summarized in Table 1.The study area was separated into 27 field-plants (Figure 2).In each field, we collected an n amount of leaves from n number of trees.Both numbers variated according to plant-field size and the number of trees per field.In total, approximately 4000 leaf samplings were gathered in this area.The method applied here followed standard recommended procedures.For each citrus-tree sampled, we collected the 3rd or 4th leaf of a fruit-branch, at a medium canopy height.The leaves were all visually health with no signs of diseases or damage.They were separated and identified in plastic bags and submitted to the laboratory analysis.
In the laboratory, leaf area (cm 2 ) was measured for each sample using a digital analysis method [37].Later, they were washed and dried in an oven at 60-65 °C for 48 h, and then crushed.The Kjeldahl titration method was applied to determine the LNC.This method is divided into three stages: (1) digestion, (2) distillation in a nitrogen distiller, and (3) titration with sulfuric acid (H2SO4) The flight was conducted between 13:00 and 14:00.(local time), at 120 m high, resulting in a 12.9 cm ground sample distance (GSD) image.An eBee SenseFly UAV equipped with the Parrot Sequoia camera was used.This camera records images in the following spectral regions: green (530-570 nm), red (640-680 nm), red-edge (730-740 nm), and near-infrared (770-810 nm).Before the flight, a calibration plaque unique for the Sequoia equipment was recorded with the Parrot Sequoia camera to normalize the local illumination.The main characteristics of the UAV-mounted sensor used are summarized in Table 1.The study area was separated into 27 field-plants (Figure 2).In each field, we collected an n amount of leaves from n number of trees.Both numbers variated according to plant-field size and the number of trees per field.In total, approximately 4000 leaf samplings were gathered in this area.The method applied here followed standard recommended procedures.For each citrus-tree sampled, we collected the 3rd or 4th leaf of a fruit-branch, at a medium canopy height.The leaves were all visually health with no signs of diseases or damage.They were separated and identified in plastic bags and submitted to the laboratory analysis.
In the laboratory, leaf area (cm 2 ) was measured for each sample using a digital analysis method [37].Later, they were washed and dried in an oven at 60-65 • C for 48 h, and then crushed.The Kjeldahl titration method was applied to determine the LNC.This method is divided into three stages: (1) digestion, (2) distillation in a nitrogen distiller, and (3) titration with sulfuric acid (H 2 SO 4 ) [38].
After this, the averaged LNC values were associated with their correspondent field-plant.In our studied area, we obtained LNC between 23.2 and 29.5 g•kg −1 , with a variance of 2.33 g•kg −1 .

Image Pre-Processing and Sampling Points
The image pre-processing was performed in the Pix4DMapper software, in which we divided two mosaic blocks to optimize it (Figure 2).We first optimized the interior and exterior parameters and generated the sparse dense cloud based on the structure-from-motion (SfM) method.Later, we generated the point clouds based on MVS (multi-view stereo) approach.For the SfM, we used a total of nine control points in cross-format with approximately 50 cm × 50 cm in size, distributed equally in the experimental area.We measured the coordinates of these targets with a Leica Plus GS15 Global Navigation Satellite System (GNSS), dual-frequency in real-time kinematic (RTK) mode, with a 3 mm precision.
The UAV flight was approved by the Department of Airspace Control (DECEA), responsible for the Brazilian airspace.The images were acquired with an 80% longitudinal and 60% lateral overlaps.The orthomosaic was composed of 2389 scenes altogether.We converted the digital number (DN) values to surface reflectance values using the calibration parameters described in the Parrot Sequoia manual [39].Finally, an orthorectified surface reflectance image was generated for each band at each block (I and II).Both image blocks were used to create a unique mosaic.
In a GIS environment, we manually identified 33,600 citrus-trees in our experimental area (Figure 2).This was performed in the QGIS 3.4 open-source software and used photointerpretation techniques to delineate point-features to mark the location of each tree.We attributed a radius (1.1-1.4 m) for each tree-canopy in order to calculate their respective leaf area index (LAI) in relation to the ground area.The mentioned variation in radius was used because of the difference in canopy sizes.
Light interaction at the canopy level is dominantly affected by canopy structure, and the leaf properties may be canceled out.Since our image data is at a landscape level, spectral vegetation indices should only be linked to LNC after considering this detail.To correctly compare average LNC measured in the laboratory with data extracted from the UAV-based image, we scaled up the LNC from leaf to canopy level (CNC).To do this, we multiplied the averaged LNC of each plant-field with the calculated LAI.This process can be described by Equation (1) [40].This procedure resulted in 33,600 trees with known scaled up nitrogen content.
where LNC l is the averaged value measured in the laboratory and LAI is given by the ratio between the leaf area and ground area.LNC was measured in g•kg −1 , while LAI is dimensionless.The resulting CNC was also in g•kg −1 .This equation is based on a canopy development model that considered the relationship between nitrogen content and the LAI at different growth stages [40,41].In our study case, the citrus-trees were evaluated during their intermediate phase (i.e., with neither young or old leaves), so a linear relationship can be assumed [41].
We separated the trees into training and testing data-sets (Figure 2).The training points consisted of 90% (80% train and 10% validation) of the entire data-set, while the testing points were represented by the remaining 10%.We evaluated the distributions for the validation and testing data to determine if there was a significant difference between samples (Figure 3).This prior evaluation returned a normal distribution for both datasets (Shapiro-Wilk p-value equal to 0.77 and 0.79) and no statistical difference between both means (test t student p-value of 0.5144).

Spectral Vegetation Indices
To gather the available spectral vegetation indices to this study, we based our selection on the Index Database [42].We considered the spectral indices associates with the Parrot Sequoia band ranges (Table 2).We identified them according to their purpose (variable) and scale (canopy and/or leaf level).The values of parameters such as soil-lines (L), which are required by some spectral indices, were adopted based upon literature recommendation.

Spectral Vegetation Indices
To gather the available spectral vegetation indices to this study, we based our selection on the Index Database [42].We considered the spectral indices associates with the Parrot Sequoia band ranges (Table 2).We identified them according to their purpose (variable) and scale (canopy and/or leaf level).The values of parameters such as soil-lines (L), which are required by some spectral indices, were adopted based upon literature recommendation.The relation between the spectral indices and the CNC was calculated using linear and exponential regressions.The metrics used to evaluate them were the regression coefficient (R 2 ), the root-mean-squared error (RMSE), and the correlation coefficient (r) values.This prediction returned a statistical comparison for the individual spectral indices and helped evaluate their performance.For both regression and correlation analysis, we adopted a coefficient interval of 95%.

Analysis
The RF algorithm is based on regression trees and relies on the hypothesis that the overall accuracy can be improved by implementing the prediction results of combined independent predictors [20].As previously stated, we distributed the 33,600 trees into training (80% train and 10% validation) and testing (10%) datasets.In a computational environment, we needed to define the number of trees, the number of nodes and the stop criteria for the RF model.To avoid overfitting, we performed a hyperparametrization process.
To define the most appropriate hyperparameter, we used a cross-validation stochastic approach, where we separated our dataset into 10 folds.One-fold was used to validate the model performance, while the remaining nine folds were used to train the model.This test was repeated until all the 10 folds were evaluated individually.In our study, the number of nodes did not interfere with the prediction accuracy, so a fixed parameter was adopted after initial tests.We determined the number of trees to be equal to 200 since it did not result in any practical gains with higher quantities (Figure 4).prediction accuracy, so a fixed parameter was adopted after initial tests.We determined the number of trees to be equal to 200 since it did not result in any practical gains with higher quantities (Figure 4).We implemented an extreme gradient boosting (XGBoost) model to verify its impact on the RF performance.The XGBoost uses a forward-learning ensemble method to obtain predictive results in gradually improved estimations.This model computes second-order gradients of the loss function and an advanced regularization (L1 and L2) type [43].We then performed an evaluation of the models' accuracy when implementing less spectral indices.For this, we selected the 5 and 10 spectral indices that presented a higher contribution to our model.Lastly, since our RF model consisted of 200 trees, we evaluated its trees by a Pythagorean plot.As shorter trees are better in contributing to prediction values, we plotted one example of its first five levels to ascertain the relationship between the spectral indices in the RF model.
The compiled dataset was also used in other machine learning algorithms, like ANN, SVM, DT and LR [44].These algorithms are considered standard approaches in machine learning evaluation and therefore were compared against RF to test its robustness.We applied the same conjunction of training and test data and performed their hyperparameterization.For this, we used a crossvalidation stochastic approach, and data folds implemented in the RF evaluation were also used for these algorithms.The RF and the remaining machine learning algorithms were processed with the open-source RapidMiner 9.5 software, which runs in its own Python library [45].The parameters of all methods have been set to the library default values except those described in this section.
The hyperparameterization process considered the individual characteristics of the evaluated algorithms.The stop criteria were defined once it did not reduce the MAE since it only increased the processing time needed.For the ANN algorithm, we adopted one hidden layer with 500 neurons and applied a linear activation function to the output layer.We also adopted the Adam Optimizer with a regularization (α) equal to 0.0001.The SVM was applied with a radial basis function (RBF) kernel exp(−g|x − y| 2 ), where the gamma (g) value was set automatically, with a regression loss equal to 50.00, a tolerance of 0.001 and an interaction limit of 500.For the DT method, we determined the number of leaves to be equal or higher than 2 and adopted a maximum tree-depth of 100.Finally, we applied two regression models using the Ridge (L2) regularization and a Lasso (L1) regularization, with both strengths (α) equal to 0.015.
The proposed approach was evaluated with the following metrics: mean squared error (MSE); coefficient of variance of the root mean square error (CVRMSE); mean absolute error (MAE); and R 2 .We then qualitatively evaluated the RF predictions by plotting it in a regression graphic and also calculating the individual contribution of each spectral vegetation index for the model.Finally, we loaded the prediction results in a map, indicating the nitrogen content at each tree-canopy.For that, we created a new column feature in our tree dataset.This map was used to evaluate qualitatively the CNC through the experimental area.We implemented an extreme gradient boosting (XGBoost) model to verify its impact on the RF performance.The XGBoost uses a forward-learning ensemble method to obtain predictive results in gradually improved estimations.This model computes second-order gradients of the loss function and an advanced regularization (L1 and L2) type [43].We then performed an evaluation of the models' accuracy when implementing less spectral indices.For this, we selected the 5 and 10 spectral indices that presented a higher contribution to our model.Lastly, since our RF model consisted of 200 trees, we evaluated its trees by a Pythagorean plot.As shorter trees are better in contributing to prediction values, we plotted one example of its first five levels to ascertain the relationship between the spectral indices in the RF model.
The compiled dataset was also used in other machine learning algorithms, like ANN, SVM, DT and LR [44].These algorithms are considered standard approaches in machine learning evaluation and therefore were compared against RF to test its robustness.We applied the same conjunction of training and test data and performed their hyperparameterization.For this, we used a cross-validation stochastic approach, and data folds implemented in the RF evaluation were also used for these algorithms.The RF and the remaining machine learning algorithms were processed with the open-source RapidMiner 9.5 software, which runs in its own Python library [45].The parameters of all methods have been set to the library default values except those described in this section.
The hyperparameterization process considered the individual characteristics of the evaluated algorithms.The stop criteria were defined once it did not reduce the MAE since it only increased the processing time needed.For the ANN algorithm, we adopted one hidden layer with 500 neurons and applied a linear activation function to the output layer.We also adopted the Adam Optimizer with a regularization (α) equal to 0.0001.The SVM was applied with a radial basis function (RBF) kernel exp(−g|x − y| 2 ), where the gamma (g) value was set automatically, with a regression loss equal to 50.00, a tolerance of 0.001 and an interaction limit of 500.For the DT method, we determined the number of leaves to be equal or higher than 2 and adopted a maximum tree-depth of 100.Finally, we applied two regression models using the Ridge (L2) regularization and a Lasso (L1) regularization, with both strengths (α) equal to 0.015.
The proposed approach was evaluated with the following metrics: mean squared error (MSE); coefficient of variance of the root mean square error (CVRMSE); mean absolute error (MAE); and R 2 .We then qualitatively evaluated the RF predictions by plotting it in a regression graphic and also calculating the individual contribution of each spectral vegetation index for the model.Finally, we loaded the prediction results in a map, indicating the nitrogen content at each tree-canopy.For that, we created a new column feature in our tree dataset.This map was used to evaluate qualitatively the CNC through the experimental area.

Results
Spectral indices were computed to evaluate the direct relation with CNC in citrus-tress (Table 3).At least 12 of the tested spectral indices (total of 33) presented a regression coefficient above 0.5 and only 05 had a correlation coefficient higher than 0.7 in linear and exponential regressions.In literature, lower correlation values (0.5) have been used to determine regions favorable to the estimation of nitrogen content in citrus trees [31].Though, in our study, most of these spectral indices presented RMSE higher than 1 g•kg −1 , which is a considerable discrepancy for the CNC in our experimental area.Indices highlighted showed a regression coefficient (R 2 ) above 0.50.All spectral indices returned a p-value under 0.05.
In our machine learning analysis, the proposed framework considering the RF model performed better than most of the other machine learning algorithms (Table 4) and individual spectral indices (Table 3).The algorithm returned a prediction with an MSE of 0.307 g•kg −1 , and MAE of 0.341 g•kg −1 and an R 2 equal to 0.90.The XGBoost model implemented also returned similar metrics.Other algorithms like DT presented interesting results, being closer to the predictions of the RF model.This is to be expected since the random forest is based on the idea of multiple decision trees.Algorithms such as SVM, ANN, and LR had lower performances.However, they were still better than the previous individual spectral indices analysis.
The CNC predicted by the proposed framework with the RF was evaluated in a plot considering the measured CNC in comparison with the returned CNC from the prediction (Figure 5).Although the graphic shows some predictions distancing from the 1:1 relationship (dashed line), the high amount of data used (n = 3360) helped to estimate the result in a regression coefficient of 0.90.A slight decline in the line suggests that our approach was better at predicting CNC between 26 and 28 g•kg −1 .Other algorithms like DT presented interesting results, being closer to the predictions of the RF model.This is to be expected since the random forest is based on the idea of multiple decision trees.Algorithms such as SVM, ANN, and LR had lower performances.However, they were still better than the previous individual spectral indices analysis.

Remote
The CNC predicted by the proposed framework with the RF was evaluated in a plot considering the measured CNC in comparison with the returned CNC from the prediction (Figure 5).Although the graphic shows some predictions distancing from the 1:1 relationship (dashed line), the high amount of data used (n = 3360) helped to estimate the result in a regression coefficient of 0.90.A slight decline in the line suggests that our approach was better at predicting CNC between 26 and 28 g•kg −1 .The contribution of each spectral index for the RF model (Figure 6) showed how the highest related spectral indices with CNC (Table 2) assisted the model into the prediction.This information should be considered when analyzing the performance of the model, since it may help future research to reduce the amount of data incorporated into the algorithm.For the prediction of CNC in citrustrees, the returned results indicate a higher contribution of spectral vegetation indices like SR750-550 (8.2%), TriVI (7.3%), and CI (Red-edge; 6.2%).The first 10 spectral indices composed more than 55% of the contribution value (Figure 6).The contribution of each spectral index for the RF model (Figure 6) showed how the highest related spectral indices with CNC (Table 2) assisted the model into the prediction.This information should be considered when analyzing the performance of the model, since it may help future research to reduce the amount of data incorporated into the algorithm.For the prediction of CNC in citrus-trees, the returned results indicate a higher contribution of spectral vegetation indices like SR750-550 (8.2%), TriVI (7.3%), and CI (Red-edge; 6.2%).The first 10 spectral indices composed more than 55% of the contribution value (Figure 6).By implementing the best five and 10 spectral indices into the RF model, we verified a slight decrease in its performance (Table 5).This is indicative of how even lower contributions may assist the model.Regardless, this decrease was relatively small, and a tradeoff between the number of spectral indices used and the obtained accuracy is something that should be considered.Another observation is that the XGBoost model presented better results, which may consist of an alternative to reduce the number of spectral indices while improving the performance of the algorithm.A qualitative evaluation of one of the most representative trees returned by the random forest model helped ascertained the relationship between the spectral indices (Figure 7).An evaluation of shorter trees demonstrated that the best individual spectral indices (Figure 6) returned the strongest contributions.By implementing the best five and 10 spectral indices into the RF model, we verified a slight decrease in its performance (Table 5).This is indicative of how even lower contributions may assist the model.Regardless, this decrease was relatively small, and a tradeoff between the number of spectral indices used and the obtained accuracy is something that should be considered.Another observation is that the XGBoost model presented better results, which may consist of an alternative to reduce the number of spectral indices while improving the performance of the algorithm.A qualitative evaluation of one of the most representative trees returned by the random forest model helped ascertained the relationship between the spectral indices (Figure 7).An evaluation of shorter trees demonstrated that the best individual spectral indices (Figure 6) returned the strongest contributions.By implementing the best five and 10 spectral indices into the RF model, we verified a slight decrease in its performance (Table 5).This is indicative of how even lower contributions may assist the model.Regardless, this decrease was relatively small, and a tradeoff between the number of spectral indices used and the obtained accuracy is something that should be considered.Another observation is that the XGBoost model presented better results, which may consist of an alternative to reduce the number of spectral indices while improving the performance of the algorithm.A qualitative evaluation of one of the most representative trees returned by the random forest model helped ascertained the relationship between the spectral indices (Figure 7).An evaluation of shorter trees demonstrated that the best individual spectral indices (Figure 6) returned the strongest contributions.The predictions returned by the proposed approach were incorporated into the map dataset.This procedure resulted in a qualitative map where a field technician can evaluate the CNC in each known citrus-tree with a prediction R 2 of 0.90 (Figure 8).The predictions returned by the proposed approach were incorporated into the map dataset.This procedure resulted in a qualitative map where a field technician can evaluate the CNC in each known citrus-tree with a prediction R 2 of 0.90 (Figure 8).

Discussion
The proposed framework of this study predicted, with high accuracy (R 2 of 0.90 and MSE of 0.307 g•kg −1 ), the amount of CNC present in citrus trees.In a previous study in the same area, we applied the SAM algorithm while submitting simulated spectral curves as input data, reaching an accuracy of 85.7% [36].The method employed here allowed us to determine if machine learning models, specifically RF, were capable of performing this task.A contribution of this study is the use of spectral vegetation indices as input variables in a machine learning model to predict the amount of N2 at a tree-canopy level.The method presented here can be replicated to other orchards and cultivars once specifics such as sensor type and available spectral indices are considered.
As related, spectral indices have proved to be an important mechanism in the evaluation of N2 in other crops [22][23][24][25].However, our results showed a low prediction accuracy (R 2 below 0.7) by relating them directly to the CNC in the citrus-trees.Regardless, in the RF model, spectral indices developed considering red-edge bands generally performed better than other spectral indices.This observation was also found in the evaluation of the LNC in another study [33].The majority of the high-relation indices also observed here were developed at the canopy level (Table 2).
The combination of spectral vegetation indices with machine learning models proved to be a suitable approach to predict CNC.The RF algorithm performed better than others, with decision tree being closely related.Other algorithms such as SVM and LRs showed similar accuracy to the individual spectral indices' regression values.The ANN, although had a superior advantage over SVM and LRs, returned values far below the RF and DT algorithms.This comparison indicates how appropriate the regression analysis with RF is to predict CNC.This finding was also observed in other related studies [19,[32][33][34].
The distribution of predicted values versus measured values (Figure 5) demonstrated how effective our approach was.Despite presenting errors in the extreme CNC ranges (23-24 and 29-30 g•kg −1 ), the model was able to reduce most errors in the intermediary values (26-28 g•kg −1 ).The high accuracy obtained can be explained because of the way the regression was calculated within the model since it considered the individual contribution of independent variables by combining its

Discussion
The proposed framework of this study predicted, with high accuracy (R 2 of 0.90 and MSE of 0.307 g•kg −1 ), the amount of CNC present in citrus trees.In a previous study in the same area, we applied the SAM algorithm while submitting simulated spectral curves as input data, reaching an accuracy of 85.7% [36].The method employed here allowed us to determine if machine learning models, specifically RF, were capable of performing this task.A contribution of this study is the use of spectral vegetation indices as input variables in a machine learning model to predict the amount of N 2 at a tree-canopy level.The method presented here can be replicated to other orchards and cultivars once specifics such as sensor type and available spectral indices are considered.
As related, spectral indices have proved to be an important mechanism in the evaluation of N 2 in other crops [22][23][24][25].However, our results showed a low prediction accuracy (R 2 below 0.7) by relating them directly to the CNC in the citrus-trees.Regardless, in the RF model, spectral indices developed considering red-edge bands generally performed better than other spectral indices.This observation was also found in the evaluation of the LNC in another study [33].The majority of the high-relation indices also observed here were developed at the canopy level (Table 2).
The combination of spectral vegetation indices with machine learning models proved to be a suitable approach to predict CNC.The RF algorithm performed better than others, with decision tree being closely related.Other algorithms such as SVM and LRs showed similar accuracy to the individual spectral indices' regression values.The ANN, although had a superior advantage over SVM and LRs, returned values far below the RF and DT algorithms.This comparison indicates how appropriate the regression analysis with RF is to predict CNC.This finding was also observed in other related studies [19,[32][33][34].
The distribution of predicted values versus measured values (Figure 5) demonstrated how effective our approach was.Despite presenting errors in the extreme CNC ranges (23-24 and 29-30 g•kg −1 ), the model was able to reduce most errors in the intermediary values (26-28 g•kg −1 ).The high accuracy obtained can be explained because of the way the regression was calculated within the model since it considered the individual contribution of independent variables by combining its results.Still, it was recommended that future research always compare it against other machine learning algorithms.
We considered a total of 33 spectral indices, which was more than previous similar studies have used [19,33].The individual contribution of each spectral index (Figure 6) demonstrated that the first 10 indices accounted for more than 55% of the total contribution for RF.Additionally, we performed evaluation tests considering the first five and 10 spectral indices (Table 5), in which also returned high accuracies.An evaluation of the shorter trees (Figure 7) corroborated the information shown by the individual spectral indices rank (Figure 6).Lastly, the XGBoost model helped to improve the accuracy of the algorithm when using a smaller number of spectral indices (Table 5).This indicates that it is possible to reduce the number of spectral indices used and still obtain highly accurate results.This information is important since it helps new researches to reduce the amount of processed data, which impacts training and testing time performances.
An adverse condition mentioned by other studies is the contribution of soil brightness to CNC evaluation.As spectral indices are directly obtained from reflectivity, it makes it difficult to avoid background effects [19].However, in this study, since our data consisted only of delineated tree-canopies (Figures 2 and 8), the soil-brightness contribution was considered minimal.Another possible impact is the anisotropy effect of the trees.Although spectral indices are known to reduce these effects, the fact that we scaled the leaf-measured LNC in the laboratory to an N 2 in canopy-level should contribute to reducing this factor.
Finally, another contribution of our study was the construction of a map indicating the nitrogen content at a canopy level with an accurate prediction of 0.90 and an MSE of 0.307 g•kg −1 .This type of map is effective as it may offer farmers and agronomic technicians the opportunity to evaluate individual plants.The agronomical method of collecting leaf-tissue and performing its chemical analysis in the laboratory is spatially limited due to practical reasons.Since our approach returned a high prediction for each individual tree, it is safe to assume that remotely sensed data outperforms the traditional method in relation to trees covered per area.This can positively impact fertilization methods and promote better yield predictions.

Conclusions
This study proposed a new framework to infer the nitrogen content at canopy-level in citrus trees.We evaluated the performance of the RF algorithm associated with spectral indices and compared it with other machine learning algorithms.Our approach demonstrated that the combination of spectral vegetation indices and the random forest algorithm is a powerful tool for CNC estimation.While a regression between the spectral indices and the CNC returned low coefficients (R 2 at 0.10-0.63), the combined indices into the RF model resulted in an R 2 of 0.90 and an MAE of 0.341 g•kg −1 .This accuracy was higher than previous research, in which we evaluated spectral analysis algorithms for the same experimental field.In conclusion, we recommend the integration of spectral indices with machine learning algorithms like RF to assess CNC in citrus-trees.

Figure 1 .
Figure 1.The workflow of the steps of the proposed method.

Figure 1 .
Figure 1.The workflow of the steps of the proposed method.

Figure 2 .
Figure 2. Study area and points used in the evaluation of the spectral indices.

Figure 2 .
Figure 2. Study area and points used in the evaluation of the spectral indices.

Figure 3 .
Figure 3. Distribution of spectral sampling points as a function of leaf nitrogen content (LNC).

Figure 3 .
Figure 3. Distribution of spectral sampling points as a function of leaf nitrogen content (LNC).

Figure 4 .
Figure 4. Training accuracy with the difference in accuracy for the random forest (RF) model.

Figure 4 .
Figure 4. Training accuracy with the difference in accuracy for the random forest (RF) model.

Figure 6 .
Figure 6.Individual contribution (in %) of each spectral vegetation index for the RF model.

Figure 7 .
Figure 7. Example of one short tree (initial 5-levels) of the RF model applied.

Figure 6 .
Figure 6.Individual contribution (in %) of each spectral vegetation index for the RF model.

17 Figure 6 .
Figure 6.Individual contribution (in %) of each spectral vegetation index for the RF model.

Figure 7 .
Figure 7. Example of one short tree (initial 5-levels) of the RF model applied.Figure 7. Example of one short tree (initial 5-levels) of the RF model applied.

Figure 7 .
Figure 7. Example of one short tree (initial 5-levels) of the RF model applied.Figure 7. Example of one short tree (initial 5-levels) of the RF model applied.

Figure 8 .
Figure 8. High-detailed image example of the CNC predicted with the RF model loaded in the entire dataset.

Figure 8 .
Figure 8. High-detailed image example of the CNC predicted with the RF model loaded in the entire dataset.

Table 1 .
Parrot Sequoia camera details and flight conditions.

Table 2 .
The spectral vegetation indices associated with the Sequoia camera used in this study.

Table 2 .
The spectral vegetation indices associated with the Sequoia camera used in this study.

Table 3 .
Regression analysis between the spectral vegetation indices and the canopy nitrogen content (CNC).

Table 4 .
Performance results of each selected algorithm prediction evaluated in this study.

Table 4 .
Performance results of each selected algorithm prediction evaluated in this study.

Table 5 .
Performance results of the random forest model with less spectral indices as input.

Table 5 .
Performance results of the random forest model with less spectral indices as input.

Table 5 .
Performance results of the random forest model with less spectral indices as input.