Identifying and Quantifying the Abundance of Economically Important Palms in Tropical Moist Forest Using UAV Imagery

: Sustainable management of non-timber forest products such as palm fruits is crucial for the long-term conservation of intact forest. A major limitation to expanding sustainable management of palms has been the need for precise information about the resources at scales of tens to hundreds of hectares, while typical ground-based surveys only sample small areas. In recent years, small unmanned aerial vehicles (UAVs) have become an important tool for mapping forest areas as they are cheap and easy to transport, and they provide high spatial resolution imagery of remote areas. We developed an object-based classiﬁcation workﬂow for RGB UAV imagery which aims to identify and delineate palm tree crowns in the tropical rainforest by combining image processing and GIS functionalities using color and textural information in an integrative way to show one of the potential uses of UAVs in tropical forests. Ten permanent forest plots with 1170 reference palm trees were assessed from October to December 2017. The results indicate that palm tree crowns could be clearly identiﬁed and, in some cases, quantiﬁed following the workﬂow. The best results were obtained using the random forest classiﬁer with an 85% overall accuracy and 0.82 kappa index.


Introduction
Palm trees are one of the most socially and economically important resources for local communities in Amazonia because they provide non-timber forest products like fruits, fabrics, fuel, and construction materials [1][2][3]. As a result, there is a high interest in improving the methods to evaluate the extent and health of the populations of palm species. This is particularly important in western Amazonia where the highest regional palm species richness is found [4], and particularly in the northern Peruvian Amazon, where palm fruit harvesting makes an important contribution to the local and regional economy [5].

Data Collection
Within each permanent plot, for each tree, the relative location within the plot, species and diameter at breast height (DBH) were recorded. The height of all the palm trees and the height of 10 random trees per diameter class were measured in the plot following the RAINFOR protocol. Information of the plots is summarized in Table 1. The geographic location of the plots and the location of the palm trees were recorded with the handheld GPS Trimble Geo7X and the dualfrequency GNSS Trimble Tornado antenna, with an average error of approximately 5 m.    * The palm visibility is a proxy to explain the number of tree species that receive overhead light in the plot. It is related to the palm density/openings in the plot that make the visibility of crowns possible in the RGB image. It is expressed as the percentage of the visible palm trees in the RGB UAV mosaic: PV(%) = Visible palm trees in the UAV mosaic of the plot*100/total palm trees recorded in the plot.
The whole area of each plot was surveyed using a DJI Phantom 4 Pro (PH4 Pro) UAV from October to December 2017. The PH4 Pro is a rotary-wing aircraft with four propellers (quadcopter). It has 30 min of endurance when the payload is lower than 200 g and 12 min endurance at 400 g. The ground control station and the UAV are radio-linked at 2.4 GHz frequency. Users can control the UAV in either manual or automatic mode via a remote control connected to a tablet. The PH4 Pro consists of a GNSS (GPS + GLONASS), compass, vision system and a 20 megapixel (MP) 1" CMOS RGB camera attached to the bottom with a gimbal. The camera can record high-resolution images or high-definition videos (4K) and provides a real-time connection between the camera and the tablet [47].
The missions were performed at 60 and 90 m above ground level (AGL). The forward overlap was 88% and the side overlap was 83%. Mission details are listed in Table A1.

Data Processing
The UAV image processing comprised the following 5 steps: (1) mosaicking, (2) segmentation of the mosaic, (3) training samples preparation, (4) classification, and (5) palm tree quantification. Figure 2 shows the workflow. The mosaicking (Step 1) was carried out using the commercial software program Pix4D mapper [48] in a PC of 3.5 GHz 14-core with 128 Gb of RAM and an NVIDIA Quadro M4000 graphics processing unit (GPU). The rest of the steps were performed using the open-source software R v. 3.4.4 [49] in a laptop of 2.6 GHz quad-core with 16 GB of RAM and an NVIDIA Quadro M1000M graphic card. All the scripts generated in R, are available on the Github repository (https://github.com/xime377/UAV-classification). To speed up the testing process, the HPC Manati cluster was used. It has a coordinator node (Intel Xeon E5-2680 v4 2.40Ghz of 56 cores with 64 GB of RAM) and 9 processing nodes (Intel Xeon E5-2680 v4 2.40Ghz of 28 cores with 64 GB of RAM per node), 6 of these nodes have an NVIDIA Tesla K80 graphic card.
Pix4D mapper uses the Structure from Motion (SfM) algorithm in combination with dense image matching to generate a digital surface model (DSM) and the orthomosaic [50,51]. Since vegetation is difficult to reconstruct due to its complex 3D structure (leaves, branches), data from different UAV missions were combined and different parameters were tested to obtain orthomosaics with as few artifacts as possible. Forty-nine orthomosaics were obtained in total, having on average five mosaics per permanent plot. For further analyses, only one mosaic per plot was selected, visually selecting the one that showed the least artifacts. In some cases, the orthomosaic was acquired in one mission, in other cases, the pictures from different flights over the same plot were combined. The characteristics of the ten selected orthomosaics are presented in Table 2 and some mosaics are shown in Figure 3. Pix4D mapper uses the Structure from Motion (SfM) algorithm in combination with dense image matching to generate a digital surface model (DSM) and the orthomosaic [50,51]. Since vegetation is difficult to reconstruct due to its complex 3D structure (leaves, branches), data from different UAV missions were combined and different parameters were tested to obtain orthomosaics with as few artifacts as possible. Forty-nine orthomosaics were obtained in total, having on average five mosaics per permanent plot. For further analyses, only one mosaic per plot was selected, visually selecting the one that showed the least artifacts. In some cases, the orthomosaic was acquired in one mission,   The segmentation (step 2 of the workflow) was performed in the software program R and GRASS GIS 7.2.2. The R package rgrass7 [52] allows the implementation of GRASS GIS functions in R and facilitates the data exchange between the two software packages. The function i.segment [31] with the region growing and merging algorithm was used to group similar pixels into unique segments. This segmentation algorithm sequentially examines all the current segments in the orthomosaic, merging neighboring segments if they are similar or close according to the distance  In Pix4D mapper, the process is divided into 3 tasks. First, the initial processing aligns the images and selects key points from visual similarities between the overlapping images acquired with the RGB camera. The full keypoint image scale was selected and the automatic rematch was enabled. Second, a dense point cloud was generated using the multiscale option, selecting the 1/4 and 1/8 of the full image, and the optimal point density. Third, the DSM, the digital terrain model (DTM) and the mosaic were produced using the inverse distance weight (IDW) method and a sharp smoothing filter.
The segmentation (step 2 of the workflow) was performed in the software program R and GRASS GIS 7.2.2. The R package rgrass7 [52] allows the implementation of GRASS GIS functions in R and facilitates the data exchange between the two software packages. The function i.segment [31] with the region growing and merging algorithm was used to group similar pixels into unique segments. This segmentation algorithm sequentially examines all the current segments in the orthomosaic, merging neighboring segments if they are similar or close according to the distance formula.
Two parameters are required to set the size of the segments: a threshold value and a minimum segment size. The threshold value ranges from 0 to 1, lower threshold values would allow only identical valued pixels to merge, while higher values would allow the merging of close pixels even if they are not similar. The minsize parameter sets the minimum number of pixels in a segment, merging small segments with a similar neighbor. At higher spatial resolutions, it is recommended to have a higher minimum segment size, in order to have larger and fewer segments per orthomosaic, that captures at least one palm leaf per segment. Since the segmentation is based on the number of pixels, and the orthomosaics generated had a very high resolution (1.22-2.09 cm), the orthomosaics were re-scaled to a pixel size of 5 cm, keeping enough details of the palm trees and reducing the computation time. In general, with smaller pixel sizes, there will be more segments because the orthomosaic contains more details.
Different combinations of these parameters were tested visually in order to obtain segments that captured the shape of palm tree leaves ( Figure 4). Overall, we found that mosaics with 5 cm pixel size, a minimum size of grouping pixels was 50, and a similarity threshold of 0.05 best delineated the palm leaves.
The training sample preparation (Step 3) consisted of combining the ground data with the UAV data. The ground data comprised the palm tree locations recorded with the GPS and the Forestplots database. These data were linked, obtaining a shapefile with the palm tree tag, species name, and the RAINFOR measurements.
The UAV data consisted of the RGB mosaic, the canopy height model (CH), the segmentation output from Step 2 (a vector and a raster layer per mosaic) and the textural layers.
The shapefile layer with the ground data was overlaid on the RGB mosaic using the open-source software Quantum GIS (QGIS) to check if the location points corresponded to the palm tree crowns in the mosaic. Misaligned reference palm trees were manually aligned with the crowns in the mosaic based on the relative coordinates provided in the Forestplots database or not considered in the classification if the corresponding palm tree was not clearly identified in the mosaic. The details of the palm tree species considered for the classification are shown in Figure A1. In order to constrain the classification for the identification of palm tree species, some ground data of soil, water, and other trees were included as extra classes to avoid that the classifiers would identify them as palm trees.
The canopy height (CH) model was obtained using the package raster [53] in R. The UAV DTM was subtracted to the DSM to generate the CH layer. The textural characteristics of each segment of the orthomosaic were calculated in R, integrated with GRASS GIS 7.2.2. Table 3 gives a description of the features obtained during this step.
to a pixel size of 5 cm, keeping enough details of the palm trees and reducing the computation time. In general, with smaller pixel sizes, there will be more segments because the orthomosaic contains more details.
Different combinations of these parameters were tested visually in order to obtain segments that captured the shape of palm tree leaves ( Figure 4). Overall, we found that mosaics with 5 cm pixel size, a minimum size of grouping pixels was 50, and a similarity threshold of 0.05 best delineated the palm leaves. Only the segments that correspond to the E. precatoria palm tree (a crown with an elongated star shape) are highlighted in yellow. With smaller minsize and threshold values, there will be a higher number of segments (delimited by the red contour); with higher values in both parameters, there will be a smaller number of segments, but also less distinction among the leaves of different palm tree leaves.
The training sample preparation (Step 3) consisted of combining the ground data with the UAV data. The ground data comprised the palm tree locations recorded with the GPS and the Forestplots database. These data were linked, obtaining a shapefile with the palm tree tag, species name, and the RAINFOR measurements.
The UAV data consisted of the RGB mosaic, the canopy height model (CH), the segmentation output from Step 2 (a vector and a raster layer per mosaic) and the textural layers. Only the segments that correspond to the E. precatoria palm tree (a crown with an elongated star shape) are highlighted in yellow. With smaller minsize and threshold values, there will be a higher number of segments (delimited by the red contour); with higher values in both parameters, there will be a smaller number of segments, but also less distinction among the leaves of different palm tree leaves. The textural layers and the CH were stacked and overlaid with the shapefile containing the ground data, assigning the values to the corresponding training point. The ground truth points were split into training (2/3) and validation (1/3) dataset.
The classification (Step 4) was performed in R, using the CARET package [54], short for Classification and REgression Training. Four non-parametric decision tree algorithms were tested: (1) Kernel Nearest Neighbor (k-NN), (2) Recursive Partitioning (RP), (3) Random Forest (RF) and (4) Support Vector Machine Radial (SVMR). The default parameters of the software were used in the classifiers.
The k-NN is commonly used for single tree detection in temperate forests [12,39]. It uses the Euclidean distance from the observation to be classified to the nearest training sample observation and assigns it to that class [39,55]. The RP creates a decision tree that splits the observations several times into homogeneous groups based on several dichotomous independent variables. The process is recursive because each observation set is split an indefinite number of times until the splitting process terminates after a particular stopping criterion is reached [55]. The RF is one of the most frequently used classifiers in forest remote sensing of forests because it provides accurate results and it is less sensitive to overfitting compared to other decision trees [12,37]. It is an ensemble decision tree classifier that uses bootstrap aggregated sampling (bagging) to construct many individual decision trees, from which a final class assignment is determined [36]. The SVMR is widely used when working with tree species classification because it is robust to noise and high-dimensional data, comparably few training data is needed, and it splits the data using a non-linear approach [12,37], suitable when working with complex canopy vegetation.
To evaluate the algorithms, an ANOVA test and the post-hoc Tukey honest significant difference test were conducted.
The general performance of the different models in the classification was evaluated with the overall accuracy and the Cohen's kappa coefficient.
The overall accuracy (OA) is the total number of correctly classified segments (true positives, tp), divided by the total number of samples (N c ): where i is the number of classes. The Cohen's Kappa coefficient (κ) is a statistic that measures the agreement of prediction with the true class. It takes into account the possibility of the agreement occurring by chance (expected accuracy, EA).
where fp is the number of segments predicted as positive that were actually negative (false positives). The species identification assessment consisted of the producer and user accuracy, and the corresponding confusion matrices. The producer's accuracy (PA) is derived by dividing the number of correctly classified segments per class (tp) by the total number of segments corresponding to the ground truth of that class: The user's accuracy (UA) is the number of correctly classified segments (tp) in a class divided by the total number of segments that were classified in that class: After the classification step was conducted using all the predictors, the variable importance of the random forest models was analyzed to identify the layers that have the most predictive power in the classification per plot (feature selection). The variable importance was obtained from each plot model using the CARET package [54] in R. The layers that had repeatedly higher importance among all the plots were selected as the ones that contributed the most to palm identification.
The palm tree species quantification (Step 5) was performed in R, using the packages raster [53] and simple features [56]. This Step was mainly needed since the study area is a tropical forest dominated by Mauritia flexuosa palms and, in most cases, they were too close to each other, having many crowns in only one object. For this reason, this Step was conducted to split the crowns mask and obtain single crowns to be counted. This Step is not needed in areas with a lower density of palm species. The splitting process consisted of intersecting the five height classes from the K-means unsupervised classification of the canopy height model, with the classification crown mask. Finally, a table with the count of individuals per palm tree species was generated.
The accuracy of the palm tree quantification for each plot was determined by comparing the palm trees that were recorded during the ground data survey, and also the visible palms on the orthomosaics, with the palm trees detected by the classification algorithm. The precision, recall and F1 score were calculated per plot.
The precision is the number of polygons correctly classified (tp) as the corresponding palm species divided by the total number of polygons (N q ) generated in the quantification step: The recall is the number of polygons correctly classified (tp) as the corresponding palm species divided by the total number of ground truth data. In this case, we calculated the recall with the number of visible palms in the mosaic (Recall visible ) and the recall with the number of all the palm trees measured on the ground (Recall ground ): The F1 score is the harmonic mean of recall and precision and thus it expresses the balance between recall and precision: The F1 score was calculated for both cases: using the Recall visible and the Recall ground . This evaluation index was used in this case instead of the overall accuracy because, unlike in the classification step where the number of segments per class was similar, the abundance of Mauritia flexuosa in most of the plots was higher than the abundance of the other palm species.

Palm Species Identification
The palm tree species identification was performed using different classifiers. The Random Forest (RF) algorithm was the one with the highest overall accuracy (85% in average) and kappa coefficient (0.82 in average), closely followed by the Support Vector Machine Radial (SVMR) with 85% overall accuracy and Cohen's Kappa coefficient of 0.81 on average. There was no statistically significant difference between the results obtained from RF and SVMR, but the results of those algorithms were significantly higher than those obtained from k-NN and Recursive Partitioning (p < 0.001, 95%). Table A2 presents the evaluation of the different methods used. When examining the detection success per palm tree species, the identification of M. flexuosa was the most accurate since it was the dominant species in all plots. There was a general overestimation of the non-canopy dominant species (Astrocaryum murumuru and Oenocarpus spp.) and species with a small amount of training data (Socratea exorrhiza, Euterpe precatoria, and Attalea butyracea). The species that were not canopy dominant appeared more often with shadows, lacking enough good quality training data, and were misclassified as dark parts of trees or artifacts. In most of the cases, the classification was able to predict correctly Mauritia flexuosa, Mauritiella armata, and Euterpe precatoria even outside of the plots. Since there was no training/validation data for those areas, this was only verified visually. One of these cases is VEN-05 plot. Figure  On the other hand, plots with palm tree species with a very different crown shape, tend to obtain higher accuracy values. This can be seen when comparing QUI-01 and PIU-02, two plots with the same number of palm species and similar M. flexuosa abundance (Table 1) More complexity is added when the plots have more palm tree species, as some of the crowns On the other hand, plots with palm tree species with a very different crown shape, tend to obtain higher accuracy values. This can be seen when comparing QUI-01 and PIU-02, two plots with the same number of palm species and similar M. flexuosa abundance (Table 1). QUI-01 had a lower classification accuracy due to the presence of Mauritiella armata and less palm visibility (κ = 0.72), while PIU-02 composed just of M. flexuosa and E. precatoria, had a Cohen's Kappa coefficient of 0.86.
More complexity is added when the plots have more palm tree species, as some of the crowns of the species look similar and there is only a small amount of training data for the non-dominant species. This is the case of PRN-01, where S. exorrhiza was classified as M. flexuosa or A. murumuru and viceversa; and Mauritia flexuosa and Mauritella armata were also misclassified ( Table 4).

Feature Selection
Five layers contributed the most to palm species identification: (1) the canopy height model, (2) compactness of the segments, (3) median of the green band values per segment, (4) mean of the sum of variance of the green band values per segment, and (5) the mean entropy of the red band values per segment. The impact on the species discrimination is shown in Figure 6; the accuracy assessment using these 5 predictors is shown in Table A3.  Figure 6; the accuracy assessment using these 5 predictors is shown in Table A3.

Palm Tree Species Quantification
The palm species quantification performed better in plots where the palm density was lower or the palms that were close to each other had different heights. The results of the quantification step using the output from the random forest classification were compared with the number of visible palms in the UAV orthomosaic obtaining on average a Recall of 71.6% and an F1 score of 0.65, and with all the geolocated palms in the RAINFOR plot (average Recall = 51.4%, F1 score = 0.65). The accuracy assessment per RAINFOR plot can be seen in Table A4. Figure 7 shows the comparison of the results obtained for the Mauritia flexuosa and Mauritiella armata species with the number of visible

Palm Tree Species Quantification
The palm species quantification performed better in plots where the palm density was lower or the palms that were close to each other had different heights. The results of the quantification step using the output from the random forest classification were compared with the number of visible palms in the UAV orthomosaic obtaining on average a Recall of 71.6% and an F1 score of 0.65, and with all the geolocated palms in the RAINFOR plot (average Recall = 51.4%, F1 score = 0.65). The accuracy assessment per RAINFOR plot can be seen in Table A4. Figure 7 shows the comparison of the results obtained for the Mauritia flexuosa and Mauritiella armata species with the number of visible palms in the UAV orthomosaic (Figure 7a,b) and with all the geolocated palms in the RAINFOR plot (Figure 7c,d).
Remote Sens. 2019, 11, x FOR PEER REVIEW 17 of 30 comparison with visible UAV palms (Figure 7a,b) and in the comparison with all the field measurements (Figure 7c,d), correspond to the plots with higher palm visibility. The quantification of these palms is more successful if there is higher palm visibility and if the palm species composition is more diverse or they are not too close to each other.

Discussion
This study is one of the first attempts to detect and quantify native palm species in a complex forest such as Amazonia. Most of the previous studies that allow detection and quantification using a segmentation step before conducting the classification have been performed either in plantations [28,57] or in open forests [32], areas where the studied features are easily discriminated due to the high contrast of them with the background. In all these studies, the presence of bare soil or very little presence of small plants in the background makes easier the detection and quantification process. In plantations, the systematic arrangement of the plants facilitates the detection more notably. The workflow here managed to identify and quantify the palm tree species from RGB UAV imagery in a tropical rainforest, where almost the whole mosaic consists of green vegetation. The approach was successful in detecting palm trees due to their distinctive crowns in the rainforest [40]. The assessment of the method using ten permanent plots with 1170 reference palm trees demonstrated that small UAVs with RGB cameras are useful for mapping this aspect of tree biodiversity in tropical forests.

Palm Tree Identification and Classification Results
The workflow developed here allows a semi-automatic classification using open-source software to detect different palm species in a complex environment. The segmentation process is one of the key steps for the correct identification of the palm species and it speeds up the processing times as mentioned in previous research [29]. It is recommended to try to get larger segments with higher similarity values to delineate the object of study properly. Since we are working with high-resolution images, it is important to consider that the smaller the pixel size, the more pixels per mosaic and thus The number of palm tree stems captured by the UAV is lower than the ground data, capturing on average 69.8% of the palms present in the forest plots. This value strongly depends on the canopy density of the plot, varying from 58% in dense palm swamps, to 86% in less dense areas (Table A5). This occurs because the RGB camera only registers the top of the canopy. In Figure 7c,d, this "underestimation" of the understory palms can be seen. The points with similar values in the comparison with visible UAV palms (Figure 7a,b) and in the comparison with all the field measurements (Figure 7c,d), correspond to the plots with higher palm visibility. The quantification of these palms is more successful if there is higher palm visibility and if the palm species composition is more diverse or they are not too close to each other.

Discussion
This study is one of the first attempts to detect and quantify native palm species in a complex forest such as Amazonia. Most of the previous studies that allow detection and quantification using a segmentation step before conducting the classification have been performed either in plantations [28,57] or in open forests [32], areas where the studied features are easily discriminated due to the high contrast of them with the background. In all these studies, the presence of bare soil or very little presence of small plants in the background makes easier the detection and quantification process. In plantations, the systematic arrangement of the plants facilitates the detection more notably. The workflow here managed to identify and quantify the palm tree species from RGB UAV imagery in a tropical rainforest, where almost the whole mosaic consists of green vegetation. The approach was successful in detecting palm trees due to their distinctive crowns in the rainforest [40]. The assessment of the method using ten permanent plots with 1170 reference palm trees demonstrated that small UAVs with RGB cameras are useful for mapping this aspect of tree biodiversity in tropical forests.

Palm Tree Identification and Classification Results
The workflow developed here allows a semi-automatic classification using open-source software to detect different palm species in a complex environment. The segmentation process is one of the key steps for the correct identification of the palm species and it speeds up the processing times as mentioned in previous research [29]. It is recommended to try to get larger segments with higher similarity values to delineate the object of study properly. Since we are working with high-resolution images, it is important to consider that the smaller the pixel size, the more pixels per mosaic and thus more segments obtained [31]. This will influence the computational requirements and processing times.
In general, the accuracy of the classification was determined by plot species composition and vegetation density (expressed here as the palm visibility in the UAV mosaic). This is the case of QUI-01, VEN-04 and VEN-05, where the palm tree composition was characterized by Mauritia flexuosa and Mauritiella. armata. The main difference between these species is the size of leaves when looking from above ( Figure A1), and thus, the misclassification occurred in both directions (Table 4). VEN-05 had a higher classification accuracy (κ = 0.84) due to the lower stem density and higher palm tree visibility in the plot, with more space between palm trees (Figure 5a).
Considering that the workflow uses a relatively small amount of training data since one palm tree could have more than one segment, it is important to have good-quality training data. This is related to data acquisition: the mosaics should have enough quality to be able to extract features from them, and the mosaic should contain enough features to train and validate the model. This can be seen in the lower classification accuracy in plots where there was a lack of good-quality training data, either due to illumination conditions as the case of E. precatoria, or where there were not enough palm trees per species as the case of A. butyracea (Table 4). This methodology would also not be suitable to study understory palm tree species since the RGB UAV imagery only captures the top of the canopy.
Since there were no radiometric corrections performed in the UAV images, illumination conditions and the solar elevation angle influenced the results of the classification. Missions conducted when there was a clear sky tended to have saturated images (like in the mosaics of PRN-01 and SAM-01), resulting in M. flexuosa and E. precatoria palms with white leaves. This caused some trees to be classified as M. flexuosa or vice versa when there were white branches similar to the border of the M. flexuosa palm leaves. In the plots with the presence of E. precatoria, the overestimation of the species occurred due to the similarity of the long leaves with some bright tree branches. Missions conducted when the solar elevation angle was low (<30 • , such as in the mosaic of VEN-02 plot, mission details on Table  A1), provided images with more shadows, having similar misclassification issues as mentioned before (trees classified as palms and viceversa). One way of reducing the illumination effect could be the use of ratios between the different color bands as a preprocessing step, as the normalized ratio between the red and green bands of the RGB mosaic [21].
As mentioned in Section 3.1, the accuracy of the classification is lower when the shape of the palm tree leaves are similar. During this study, some plots contained two species that look similar from above: M. armata and M. flexuosa. M. armata has smaller costapalmate leaves with a circular outline. The stems are clustered with short, stout, conical spines (usually not seen from the top of the canopy). M. flexuosa has costapalmate leaves with a circular outline deeply split in half, and each half is split into numerous leaflets and the tips of the leaflets tend to spread in different planes. Looking from the ground, it can be seen that this palm has a solitary stem [41]. In this classification method, the Canopy height model helped to discriminate them because M. flexuosa reaches greater heights. In addition, the different size of the leaves was reflected in the compactness of the segments, and the fact that the leaves have a different arrangement leads to different values of entropy for the two species. However, differentiating other groups of similar species may be challenging [58]. For example, Cecropia latiloba (a tree with somewhat similar leaf characteristics as M. armata in a UAV image) in some plots tends to be predicted as M. armata. A similar case could occur if the palms Socratea exorrhiza and Iriartea deltoidea are found in the same image, as from above, the crown shapes look similar [40]. To overcome this challenge, other types of technologies like hyperspectral imagery or Lidar techniques could be used in the future [58,59].
In terms of processing times, the most time-consuming operations were the texture extraction and value extraction from the raster. These tasks strongly depend on the size of the mosaic. They can be sped up by working only with the five suggested layers as mentioned in Section 3.2 or splitting the mosaic in tiles that are subsequently merged. Table A6 shows the computational time consumed by each step of the workflow.

Feature Selection
The canopy height model (CH) was the layer that contributed the most to the classification. It helped to discriminate lower areas like the soil and water, but it also contributed to discriminate canopy dominant species such as M. flexuosa and lower canopy species like Oenocarpus spp. The compactness layer, since it is related to the size and shape of the segments, helped to identify larger segments as tree crowns, elongated segments as E. precatoria and compact star-shaped segments as Oenocarpus spp. This layer is quite important for the robustness of the model because it helps to discriminate species by its shape when color layers do not provide much information due to changes in illumination conditions and a lack of radiometric corrections. A clear example can be seen in Figure 6, in the compactness of VEN-02 (blue frame), where some of the training samples were shaded but the segmentation step managed to capture the shape of these palms.
The median values of the green band contributed to discriminate Mauritiella armata and Mauritia flexuosa from the rest of palm species due to the intense green leaves, and in some cases, helped to distinguish Mauritiella armata (paler green) from M. flexuosa.
The sum of variance of the green band and the mean entropy values of the red band provided information about the complexity within the mosaic. Palms with leaves spread in different planes tend to have higher entropy values. These layers contributed to discriminate A. murumuru from E. precatoria (it has leaves in one plane) and M. flexuosa from S. exorrhiza (plumose appearance).
Even though different object parameters were calculated, only compactness was chosen as the layer contributing the most to the model (Section 3.2). This is because the different parameters are often correlated: for instance, both compactness and the fractal dimension (fd) are derived from the length of a segment. Compactness and fd have a negative correlation because while compactness indicates homogeneity, fractal dimension indicates heterogeneity [35]. Regarding the textural variables, the entropy and sum of variance work as an indication of the complexity within the mosaic [35], contributing to the discrimination of different palm species due to their different leaf arrangements. In this sense, the fact that only a few layers contribute to the classification accuracy makes the process easy to understand and to be replicated.
However, in most of the cases M. flexuosa, Mauritiella armata, A. butyracea, and S. exorrhiza were hard to differentiate: the first two, due to the similarity in the leave shape, and the latter due to the lack of enough good quality training data (images with strong shadows are prone to misclassification).

Palm Tree Quantification and Validation Data
The palm tree quantification works well for areas with low palm tree density or areas with a high diversity of species since the chances of finding palms close to each other in one area are lower. When the palm species were too close to each other and they had similar heights, obtaining individual crowns was not possible and there was an underestimation of the quantification. In other cases, the splitting step caused an overestimation of the palms due to the variation in height within a single crown (higher heights in the center of the crownshaft and lower heights around it).
The number of palms captured by the UAV imagery strongly depends on the canopy density, with more visible palms in less dense areas. This method is suitable for counting canopy dominant species since understory species could appear in the UAV mosaics, but they would be partially covered by the leaves of other species and separate parts of a visible crown may be counted as different individuals. This part of the workflow was designed as a quick alternative to split crowns that are grouped as one object after the classification step.
It is important to mention that a small part of the overestimation of palms in Figure 7a,b is also due to the detection of palms with a dbh lower than 10 cm, which are not geolocated, nor considered in the RAINFOR protocol. In plots with 57%-58% of palm visibility, there were no differences in the counting; however, in plots with 67% or higher palm visibility, palms with dbh lower than 10cm start appearing in the mosaics. Considering that the number of palms measured on the ground was 1676, the number of stems that were not georeferenced was less than 1%.

Considerations for Image Acquisition
Image capture needs to deal with variation in the illumination conditions due to cloudiness, blurry images or moving objects due to winds. These issues need to be considered for the mosaicking Step, especially if data from different missions are combined. Regarding the illumination conditions, since the fieldwork was conducted in the tropics, the suitable flying hours do not vary much throughout the year; however, variation during the day is crucial. The solar elevation angle influenced the results of the mosaicking and classification due to its influence on the presence of shadows (Figure 8a). As a result, it is recommended to fly when the solar elevation angle is higher than 30 • (usually from 8:00-15:00 hours). Clouds also contribute to the presence of shadows, especially when there are the "popcorn" clouds. Overcast conditions provided more homogeneous mosaics, whereas clear sky conditions lead to saturated images. The result of combining missions with different illumination conditions (either different flying hours or presence of clouds) without a prior image normalization is a patchy mosaic (Figure 8b). For the aim of this research, radiometric calibration is not crucial since the classification is mainly based on geometrical patterns, compactness of the segments and textural information. However, the results could be improved if some brightness/shadow corrections could be conducted when the images are too dark to recognize similar pixels. Otherwise, those dark pixels will be recognized as ground by the SfM software and the segmentation step.
When combining missions when there was wind, the resulting mosaics are blurred or, in some cases, stitching was not even possible. Figure 8c shows part of a mosaic generated from one mission with strong wind, in which the palm trees are only partially visible. Even though the PH4 Pro is water-resistant [47], the pictures captured during rain events can also contain droplets of water. Even if the SfM software is able to generate a mosaic, some blurry areas may occur, or the whole mosaic may be blurry (Figure 8d), which prohibits proper segmentation and leads to poor classification results. For this reason, it is not recommended to acquire the images under poor weather conditions, like the ones described in this section.
Another important consideration is the flying height: most of the mission planning software takes into consideration the flying height above ground level (AGL), but the level of detail in a forest depends on the above canopy level (ACL). For this reason, it is necessary to know in advance the average canopy height and the maximum height of the trees. For this study, the best mosaics were obtained from the missions flying 60 m above the canopy, and, since the level of detail was extremely high, it may be possible to fly even higher (for instance 120 m AGL) in order to reduce some variation in leaves and to cover more area. With a spatial resolution of 5 cm, the level of detail was sufficient to distinguish the palm species. depends on the above canopy level (ACL). For this reason, it is necessary to know in advance the average canopy height and the maximum height of the trees. For this study, the best mosaics were obtained from the missions flying 60 m above the canopy, and, since the level of detail was extremely high, it may be possible to fly even higher (for instance 120 m AGL) in order to reduce some variation in leaves and to cover more area. With a spatial resolution of 5 cm, the level of detail was sufficient to distinguish the palm species. Figure 8. Snippets of mosaics obtained under different environmental conditions: (a) Low solar elevation angles generate images with more shadows. In this snippet, the SfM software struggles to recognize tie points in dark pixels producing a low-quality mosaic where E. precatoria is not properly reconstructed, and later the segmentation step groups all of the dark pixels as one object that usually In this snippet, the SfM software struggles to recognize tie points in dark pixels producing a low-quality mosaic where E. precatoria is not properly reconstructed, and later the segmentation step groups all of the dark pixels as one object that usually ends classified as ground. (b) Changing illumination conditions produce mosaics with different coloration for the same species: the individual of M. flexuosa in the left has brighter colors because the images were recorded when the sky was clear, the other individuals of M. flexuosa in the right have paler colors due to the presence of clouds. (c) Strong winds cause the movement of the leaves of the vegetation, thus, the position of the leaves changes in each image, leading to a poor reconstruction of the crowns in the mosaic. (d) Droplets of water in the lens of the camera will be captured in the images, making mosaic generation difficult. In some cases, the mosaic will be generated but it will contain a haze effect in the areas with droplets or some artifacts.

Further Implications
The workflow developed here could also be applied to a different study object if it has a distinctive texture or shape and if the input parameters are tuned to do so. Moreover, this methodology could also be applied to high-resolution satellite imagery if the palm crowns are clearly visible. For example, the WorldView-3 satellite imagery (spatial resolution of 0.3 meters) can easily display the crowns of Mauritia flexuosa since the crown diameter of this palm species is on average 8 meters.
The segmentation step of this workflow could be helpful when working with deep learning and semantic classification. It could help to prepare the training data instead of delineating the features manually or using commercial software as was the case in [28] who used segments from UAV imagery for training a CNN to delineate citrus trees.
From an ecological point of view, small UAVs with only RGB cameras provide useful information in larger areas than the usually covered just by doing conventional ground-based surveys. Flying over a 0.5 ha plot took around 20 min including the assembling of the equipment and the UAV products can be used to derive different ecological indicators. The products obtained from the SfM software were the RGB mosaic, the digital surface model (DSM), and the digital terrain model (DTM). From the RGB mosaic, it is possible to visualize the emergent species and determine some illumination characteristics. If the mosaic is further processed as in this study, the combination with ground data makes possible the quantification of the canopy dominance per palm species by calculating the area of each of the species mask obtained from the classification. The gap area can also be quantified by calculating the area of the mask generated for the classes "soil" and "water". The canopy height model can be derived from the DSM as was described in Section 2 and it could provide some information about the structure of the canopy. clear  Astrocaryum murumuru Figure A1. Snippets from the orthomosaics that show the palm tree species used for the study.

Appendix C
Evaluation of the different classification methods used

Appendix C
Evaluation of the different classification methods used