# On-the-Fly Olive Tree Counting Using a UAS and Cloud Services
## 4 Results and Discussion
### Tree Counting for a Sequence of Images  
The application of the global count algorithm to a sequence of 10 consecutive images reports a total of 330 olive trees, out of the 332 counted by hand, which means an error of 0.6% in the total count. Classification performance metrics are given in Table 4. As expected, the FN occurring because trees were found too close to the edges are detected in the following overlapping images and become true positives after merging. This leads to an improvement of the recall metric from an average of 97.61-98.80%. The \(F_{1}\) score that balances the FP and the FN shows very good results (99.09%). The results for the global count can be validated graphically in Figure 11. Note that this mosaic image was built just for this paper and for algorithm testing, but it is not required during the flight to compute the global tree count. The individually-detected trees are marked using a different color for each image. Thus, a tree detected in four different images shows four different color dots over it. The UAV flight starts from the bottom of the figure and proceeds towards the top. For this reason, we observe that the trees in the bottom rows (belonging to the first image) and the trees in the top rows (from the last image) have only one dot over them, while the trees in the middle of the image have more dots. The white circles show the result of the merging. Each circle is drawn for the set of dots grouped by the nearest neighbor algorithm and represents an individual tree in the global count. The red \"cross\" symbols correspond to false negatives, and the yellow \"plus\" symbols correspond to false positives. It can be observed that the global tree count algorithm succeeds in grouping the different observations of the same tree, with most of the circles showing a perfect match with the trees. Errors are concentrated in the upper left area of the global image, which has been zoomed for clearness. They correspond to the segmentation errors related to the last images already reported in Table 2. It is worth mentioning the impact of the radius value used in the fixed-radius nearest neighbor search. An excessively high value would cause the fusion of neighboring trees, thus generating many-to-one matchings. On the other hand, an excessively low value would generate one-to-many matchings. \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline
**Images** & **GT** & **Count** & **TP** & **FP** & **FN (-b)** & **Precision** & **Recall (-b)** & \(F_{1}\) **Score (-b)** \\ \hline DJI\_0225-DJI\_0234 & 332 & 330 & 328 & 2 & 4 (3) & 99.39 & 98.80 (99.09) & 99.09 (99.24) \\ \hline \hline \end{tabular}
\end{table} 
Table 4: Classification performance metrics for a sequence of 10 images (GT: ground-truth, TP: true positive, FP: false positive, FN: false negative, (-b): excluding errors in the borderline). \begin{table}
\begin{tabular}{c c c c c c c c c c} \hline \hline
**Template** & **GT** & **Count** & **TP** & **FP** & **FN (-b)** & **Precision** & **Recall (-b)** & \(F_{1}\) **Score (-b)** \\ \hline \multirow{3}{*}{d = 20} & s = 40 & 139 & 163 & 133 & 30 & 6 (3) & 81.60 & 95.68 (97.79) & 88.08 (88.96) \\  & s = 60 & 139 & 141 & 133 & 8 & 6 (3) & 94.33 & 95.68 (97.79) & 95.00 (96.03) \\  & s = 80 & 139 & 134 & 132 & 2 & 7 (3) & 98.51 & 94.96 (97.78) & 96.70 (98.14) \\ \hline \multirow{3}{*}{d = 30} & s = 60 & 139 & 139 & 133 & 6 & 6 (3) & 95.68 & 95.68 (97.79) & 95.68 (96.73) \\  & s = 80 & 139 & 130 & 130 & 0 & 9 (3) & 100.00 & 93.53 (97.74) & 96.65 (98.86) \\  & s = 100 & 139 & 128 & 128 & 0 & 11 (3) & 100.00 & 92.09 (97.71) & 95.88 (98.84) \\ \hline \multirow{3}{*}{d = 40} & s = 80 & 139 & 128 & 128 & 0 & 11 (5) & 100.00 & 92.09 (96.24) & 95.88 (98.08) \\  & s = 100 & 139 & 126 & 126 & 0 & 13 (5) & 100.00 & 90.65 (96.18) & 95.09 (98.05) \\ \cline{1-1}  & s = 120 & 139 & 124 & 124 & 0 & 15 (6) & 100.00 & 89.21 (95.38) & 94.30 (97.64) \\ \hline \hline \end{tabular}
\end{table}