Open-access Mapping urban trees using high spatial resolution aerial imagery

Abstract:

The accurate mapping of urban canopy cover is crucial for urban planning, environmental management, and ensuring equitable access to green infrastructure. However, traditional mapping methods face limitations in scalability, cost, and generalization capability. This study addresses these challenges by evaluating the performance of advanced deep learning models for semantic segmentation of urban canopy cover in high-resolution aerial imagery with a 25 cm ground sample distance (GSD). We conducted a comparative analysis between established Convolutional Neural Network (CNN) architectures (U-Net, DeepLabV3, PSPNet) and a foundation model, the Segment Anything Model (SAM), adapted with Low-Rank Adaptation (LoRA). The models were trained on a diverse dataset covering seven cities in São Paulo, Brazil, and independently tested on three other cities, encompassing different biomes and climates. The SAMLoRA (ViT-H) model achieved robust performance, reaching an average Intersection over Union (IoU) of 0.887 using only RGB bands, demonstrating that advanced architectures are less dependent on the near-infrared (NIR) band. The validated model was then applied to the municipality of Tarabai-SP, generating a portfolio of cartographic products, which revealed a 14.06% canopy cover and significant spatial inequalities. This work validates an accurate, economically viable, and scalable workflow for urban canopy inventory.

Keywords:
Urban Forestry; Deep Learning; Semantic Segmentation; Vision Transformer; High-Resolution Imagery; GIS

1. Introduction

The global urbanization process presents significant challenges to environmental sustainability and quality of life in cities. In this context, urban canopy cover emerges as a multifunctional and essential green infrastructure, increasingly recognized as an indispensable nature-based solution for contemporary urban planning (Jabbar et al. 2022; Zölch et al. 2019). Its contributions, understood as ecosystem services, include microclimate regulation by mitigating Urban Heat Islands (UHIs), improving air quality, managing stormwater, and promoting public health and well-being (Yang et al. 2024; Meili et al. 2025).

However, the effectiveness of these services depends directly on the location, density, and accessibility of the canopy. Unequal distribution can exacerbate socio-environmental disparities. Therefore, an accurate and detailed mapping of canopy cover is an instrument of environmental justice, allowing for the diagnosis of “green deserts” and guiding public policies for a more equitable distribution of green infrastructure. Despite its importance, large-scale mapping faces technical challenges. Traditional methods have their value in specific contexts, but they present intrinsic limitations for dynamic, evidence-based urban management, such as low scalability, high cost, and poor generalization capabilities.

Manual vectorization through visual interpretation is historically used as a reference for accuracy but is subjective, time-consuming, and not scalable for large areas or periodic updates (Pagliari and Dorigon 2013). Automated methods based on spectral indices like NDVI are efficient but problematic in complex urban environments, as they confuse canopy with other green surfaces and are sensitive to shadows. Pixel-based supervised classifiers (e.g., Maximum Likelihood) represent an advance but suffer from “salt-and-pepper” noise and poor generalization, as their statistical models are strictly calibrated to specific image conditions, requiring new training samples for each new area or date. Object-Based Image Analysis (OBIA) emerged to overcome pixel-based noise by segmenting images into objects and classifying them using spectral, shape, and texture features. While effective for high-resolution imagery, OBIA models also lack transferability, requiring rule-set adjustments for different scenes.

This context justifies the exploration of deep learning approaches, which aim to learn target patterns across multiple contexts and generalize the acquired knowledge, minimizing the need for constant resampling. Architectures like Convolutional Neural Networks (CNNs) revolutionized computer vision by learning hierarchical features from local receptive fields. More recently, Vision Transformers (ViT) marked an advance over CNNs by capturing long-range dependencies and global image context through a self-attention mechanism, a feature particularly advantageous for analyzing heterogeneous urban landscapes (Aleissaee et al. 2023). The advent of foundation models like the Segment Anything Model (SAM), pre-trained on an unprecedented scale, offers robust generalization capabilities (Kirillov et al. 2023). Recent studies (Gui et al. 2024; Pedley and Morgenroth 2025) demonstrate that the adaptation of SAM and advanced deep learning models for remote sensing imagery provides a significant improvement in delineating complex features, proposing specific evaluations for urban canopy and green spaces extraction. However, adapting such large models for a specialized task like segmenting canopy in aerial orthoimagery is computationally prohibitive. This impasse is solved by Parameter-Efficient Fine-Tuning (PEFT) techniques like Low-Rank Adaptation (LoRA), which allows for the specialization of large models with a fraction of the computational cost (Hu et al. 2021).

This study is justified by the need to develop and validate a methodology that generates a cartographic product with sufficient accuracy and detail to serve as a reliable subsidy for public managers. The research proposes a rigorous validation to test the hypothesis that a foundation model adapted with LoRA (SAMLoRA) can achieve higher accuracy than established CNNs.

2. Materials and Methods

2.1 Materials

The study used four-band (RGB-NIR) aerial orthophotos with a 25 cm Ground Sample Distance (GSD). The aerial imagery dataset was produced through a multi-institutional consortium involving the Instituto Geográfico e Cartográfico do Estado de São Paulo (IGC-SP) and private entities. Due to the proprietary restrictions of this partnership, precise temporal metadata and acquisition dates for specific image tiles are not publicly tracked or authorized for disclosure. Ancillary data included census sector boundaries from the Instituto Brasileiro de Geografia e Estatística (IBGE), biome maps, and street network data from OpenStreetMap (OSM) for the case study area. All data processing and model training were conducted on a workstation equipped with an Intel Core i7-13700K CPU, 64 GB of RAM, and an NVIDIA RTX A4000 GPU (16 GB VRAM), using ArcGIS Pro 3.5.0 and QGIS 3.40.5.

2.2 Method

The study area comprised ten municipalities in São Paulo, Brazil, strategically selected to represent the state’s geo-environmental diversity (Figure 1). Seven cities were used for training/validation, and three (Itapetininga, Jaguariúna, and Santos) were reserved for independent testing, ensuring a robust assessment of model generalization across different biomes, climates, and urban contexts. All geospatial data used the SIRGAS2000 geodetic reference system.

Figure 1:
Location of the Study Cities in the Biomes of São Paulo.

The experimental protocol followed five stages (Figure 2).

Figure 2:
Diagram of the methodology used for mapping urban tree regions.

First, a reference dataset was created. A total of 460 patches (256 × 256 pixels) were extracted from the ten cities, equivalent to a nominal aggregate footprint of 188.42 ha at 25 cm GSD (before accounting for any overlap between patches). Tree canopies within these areas were manually annotated by visual interpretation, following a detailed protocol adapted from Weinstein et al. (2020). Figure 3 presents examples of the RGB patches and corresponding manual reference masks, illustrating the complexity of canopy boundaries.

Figure 3:
256x256 RGB training patch (1) alongside their corresponding manual vectorization masks in white (2).

The manually delineated polygons were rasterized into single-band, 8-bit masks (1 for ‘tree’, 0 for ‘non-tree’). The resulting dataset was highly imbalanced (3.3% tree pixels). To mitigate overfitting and increase data diversity, data augmentation was applied during training (random crops, dihedral rotations, brightness/contrast variations, and zoom).

Second, a comparative evaluation of multiple deep learning models was conducted. The comparative evaluation included established CNNs (U-Net, DeepLabV3, PSPNet, MMSegmentation) and the transformer-based SAMLoRA. The ViT-B backbone contains approximately 86 million parameters, while the ViT-H contains around 632 million. The fine-tuning of the foundation models was executed utilizing the SAMLoRA module integrated within the ArcGIS Pro environment. Due to the proprietary nature of this software, specific architectural adaptations and hyperparameters, such as the exact LoRA rank and the targeted attention blocks, are encapsulated. The training procedure followed the software’s standard protocol, maintaining default parameters, such as a label opacity of 0.5, to ensure methodological reproducibility for users with platform access (ESRI 2024). A key part of the analysis was to assess the impact of the NIR band, training models on (i) RGB and (ii) NIR-R-G compositions.

Third, performance was quantified using Intersection over Union (IoU), Overall Accuracy, Precision, Recall, F1-score, and Balanced Accuracy. For the independent RGB test, the two selected models (DeepLabV3 and SAMLoRA ViT-H) were evaluated on the same spatial domain in each municipality after matching the prediction rasters to the reference grid. Each paired evaluation comprised 6,298,626 pixels, including canopy and background, corresponding to 91.62%, 94.37%, and 95.85% of the reference evaluation extent in Itapetininga, Jaguariúna, and Santos, respectively. The positive class represented canopy. The model mean and sample standard deviation were calculated across the three cities. The earlier spectral-composition assessment was retained as a separate experiment and is not numerically pooled with this paired test. Computational costs were also recorded.

3. Results and Discussion

The earlier spectral-composition experiment (Table 1) indicated an increase of 0.034 in the mean IoU of DeepLabV3 when NIR-R-G imagery was used instead of RGB, versus an increase of 0.011 for SAMLoRA ViT-H. These results suggest lower sensitivity to the additional near-infrared information in the foundation model under the tested conditions. Because the evaluation and aggregation protocol of this spectral experiment differs from the subsequent common-domain reassessment, Table 1 values should not be interpreted as the RGB city-level averages of Table 2.

To evaluate geographic transferability under a common spatial support, Table 2 reports IoU, Precision, and Recall by independent test municipality for RGB imagery. In Itapetininga, SAMLoRA ViT-H achieved IoU = 0.916 versus 0.864 for DeepLabV3, a difference of 0.052. In Jaguariúna, the respective IoUs were 0.853 and 0.734, a difference of 0.119; Precision increased from 0.772 to 0.899. The results show improvements in canopy segmentation in the same evaluated pixels, rather than across unmatched raster extents.

In Santos, SAMLoRA ViT-H obtained an IoU of 0.892, compared with 0.786 for DeepLabV3, corresponding to a difference of 0.106. The SAMLoRA advantage was therefore observed in all three independent settings, although its magnitude varied. Across cities, mean IoU was 0.887 ± 0.031 for SAMLoRA ViT-H and 0.795 ± 0.065 for DeepLabV3 (mean ± sample standard deviation); mean Precision was 0.932 versus 0.844, while mean Recall was 0.948 versus 0.932. The lack of precise acquisition-date metadata limits direct assessment of seasonal effects. In particular, leaf loss, variable canopy shadowing, and changes in illumination may affect RGB-based delineation.

Table 1:
Mean IoU in the original spectral-composition experiment (not the paired evaluation).
Table 2:
City-level IoU, Precision, and Recall on matched RGB test domains (6,298,626 pixels per city).

Figure 4 summarizes the IoU values in the spatially paired test domains for the two models.

Figure 4:
IoU of DeepLabV3 and SAMLoRA ViT-H in independent cities on the same evaluated pixels (RGB imagery).

The paired evaluation supports the selection of SAMLoRA ViT-H over DeepLabV3 on all three independent RGB scenes. It achieved a mean F1-score of 0.940, compared with 0.885, and a mean Balanced Accuracy of 0.967, compared with 0.949. These values refer to the paired two-model evaluation only, rather than to all architectures listed in the original exploratory comparison. Qualitative inspection also indicated more coherent canopy boundaries in the selected examples.

Table 3 provides the city-averaged pixel proportions from the paired confusion matrices. Each proportion was calculated relative to all 6,298,626 evaluated pixels in its city before computing the mean and sample standard deviation across the three cities.

Table 3:
Mean pixel proportions of true positives (TP), false positives (FP), true negatives (TN), and false negatives (FN), ± sample SD.

The paired confusion matrices show that SAMLoRA ViT-H reduced the mean fraction of false positives from 0.0284 to 0.0111 and the mean fraction of false negatives from 0.0106 to 0.0082. This reduction in commission and omission errors is consistent with higher Precision and Recall. Differences in these aggregate pixel fractions should not be described as boundary-only metrics, since they account for all valid pixels in each scene.

The qualitative examples illustrate model behavior in heterogeneous urban scenes. Figure 5 shows a DeepLabV3 result in Jaguariúna, where boundaries between tree crowns and other vegetated surfaces can be difficult to distinguish. The city-level results indicate lower Precision for DeepLabV3 than for SAMLoRA ViT-H (0.772 versus 0.899), consistent with more false-positive canopy assignments in the evaluated pixels. However, these examples alone do not establish a specific cause for every error.

Figure 5:
Qualitative result of the DeepLabV3 model in Jaguariúna (RGB). (1) RGB orthophoto; (2) Predicted segmentation (orange); (3) False negatives (red) and false positives (yellow).

Figure 6 presents a qualitative SAMLoRA ViT-H result in Itapetininga. The model maintained high Precision (0.955) and Recall (0.957) on the common evaluation domain, with visually coherent canopy delineation in the illustrated scene. The difference between figures from different municipalities should not be interpreted as a paired visual experiment; the paired quantitative comparison is provided in Tables 2 and 3.

Figure 6:
Qualitative result of the SAMLoRA ViT-H model in Itapetininga (RGB). (1) RGB orthophoto; (2) Predicted segmentation (orange); (3) False negatives (red) and false positives (yellow).

Regarding computational cost, SAMLoRA ViT-H had the longest training time (2h 54min), but its inference time (~6.1 s/ha) was highly competitive and only marginally slower than the fastest CNNs (~4.6 s/ha), confirming its viability for large-scale application (Table 4).

Table 4:
Training and Prediction Time per hectare.

Based on the integrated quali-quantitative analysis, the SAMLoRA ViT-H model was selected as the definitive tool. The validated model was then applied to the case study of Tarabai-SP.

3.1 Case Study: Spatial Analysis of Urban Tree Cover in Tarabai-SP

Following the model’s validation, it was applied to the municipality of Tarabai-SP, a small town not included in the training or test sets, to demonstrate its practical application. Figure 7 presents the location of the study area.

Figure 7:
Location Map of the Urban Area of Tarabai-SP.

The primary product of this inference is the Urban Canopy Cover Map (Figure 8), a vector inventory of all identified canopies. The analysis revealed 4,671 fragments, totaling 46.07 ha, which corresponds to 14.06% of Tarabai’s urban area. This base layer is fundamental for the management of the municipality’s green infrastructure.

Figure 8:
Urban canopy cover map of the municipality of Tarabai-SP.

From this inventory, a Map of Tree Fragment Classification by Area Size was produced (Figure 9). The analysis revealed a predominance of small and medium-sized fragments, characterizing Tarabai’s tree cover as mostly dispersed within residential lots, with few large, consolidated canopies restricted to specific parks and squares.

Figure 9:
Map of Tree Fragment Classification by Area Size in Tarabai-SP.

To maintain the focus on remote sensing evaluation and algorithmic performance, the broader socio-environmental spatial analyses derived from this mapping are presented in the Supplementary Material: Canopy Cover Density (Figure 10), Block-Level Distribution (Figure 11), and Accessibility to Green Areas (Figure 12). These additional analyses indicate spatial differences in the distribution of canopy cover that may inform future urban planning.

4. Conclusion

This study compared deep learning approaches for mapping urban canopy cover in high spatial resolution aerial imagery. In the spatially paired independent RGB tests, the SAMLoRA ViT-H foundation model achieved higher IoU than DeepLabV3 in Itapetininga, Jaguariúna, and Santos. These findings support its application across the sampled urban contexts, while not establishing statistical superiority beyond those independent test domains.

The model achieved a mean IoU of 0.887, mean Precision of 0.932, and mean Recall of 0.948 across three cities on common evaluation domains, compared with 0.795, 0.844, and 0.932 for DeepLabV3. A separate spectral-composition experiment suggested a smaller response to the inclusion of near-infrared information for SAMLoRA than for DeepLabV3. Application of SAMLoRA to Tarabai-SP identified 46.07 ha of canopy, equivalent to 14.06% of the urban area, and supported analysis of its spatial distribution. Interpretation should consider uncertainties associated with imagery dates, reference-mask coding, and prediction-raster exports.

Future research should evaluate additional acquisition dates and seasonal conditions, validate reference-mask conventions, and compare model outputs exported directly from inference arrays. Integrating the mapped 2D canopy polygons with LiDAR measurements may also support estimates of canopy structure and biomass.

ACKNOWLEDGEMENT

We thank CNPq (National Council for Scientific and Technological Development) for financial support through grant numbers 305814/2023-0, 403213/2023-1, 121295/2025-7, and 312816/2025-1. We also thank the IGC for providing the images used in this study.

REFERENCES

  • Aleissaee, A. A., Kumar, A., Anwer, R. M., Khan, S., Cholakkal, H., Xia, G.-S. and Khan, F. S. 2023. Transformers in Remote Sensing: A Survey. Remote Sensing, 15(7), 1860. https://doi.org/10.3390/rs15071860
    » https://doi.org/https://doi.org/10.3390/rs15071860
  • Esri. 2024. Finetune Segment Anything Model (SAM) using SamLoRA. ArcGIS API for Python Available at: https://developers.arcgis.com/python/latest/guide/finetune-sam-using-samlora/
    » https://developers.arcgis.com/python/latest/guide/finetune-sam-using-samlora/
  • Gui, B., Bhardwaj, A. and Sam, L. 2024. Evaluating the Efficacy of Segment Anything Model for Delineating Agriculture and Urban Green Spaces in Multiresolution Aerial and Spaceborne Remote Sensing Images. Remote Sensing , 16(2), 414. https://doi.org/10.3390/rs16020414
    » https://doi.org/https://doi.org/10.3390/rs16020414
  • Hu, E. J., Shen, Y., Wallis, P., Allen-Zhu, Z., Li, Y., Wang, S., Wang, L. and Chen, W. 2021. LoRA: Low-Rank Adaptation of Large Language Models. arXiv preprint, arXiv:2106.09685. https://doi.org/10.48550/arXiv.2106.09685
    » https://doi.org/https://doi.org/10.48550/arXiv.2106.09685
  • Jabbar, M., Yusoff, M. M. and Shafie, A. 2022. Assessing the role of urban green spaces for human well-being: a systematic review. GeoJournal, 87, pp. 4405-4423. https://doi.org/10.1007/s10708-021-10474-7
    » https://doi.org/https://doi.org/10.1007/s10708-021-10474-7
  • Kirillov, A., Mintun, E., Ravi, N., Mao, H., Rolland, C., Gustafson, L., Xiao, T., Whitehead, S., Berg, A. C., Lo, W.-Y., Dollár, P. and Girshick, R. 2023. Segment Anything. Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV), pp. 4015-4026. https://doi.org/10.1109/ICCV51070.2023.00371
    » https://doi.org/https://doi.org/10.1109/ICCV51070.2023.00371
  • Meili, N., Zheng, X., Takane, Y., Nakajima, K., Yamaguchi, K., Chi, D., Zhu, Y., Wang, J., Qiu, Y., Paschalis, A., Manoli, G., Burlando, P., Tan, P. Y. and Fatichi, S. 2025. Modeling the Effect of Trees on Energy Demand for Indoor Cooling and Dehumidification Across Cities and Climates. Journal of Advances in Modeling Earth Systems, 17(3), e2024MS004590. https://doi.org/10.1029/2024MS004590
    » https://doi.org/https://doi.org/10.1029/2024MS004590
  • Pagliari, S. C. and Dorigon, E. B. 2013. Arborização urbana: importância das espécies adequadas. Unoesc & Ciência - ACET, 4(2), pp. 139-148. Available at: https://periodicos.unoesc.edu.br/acet/article/view/1083
    » https://periodicos.unoesc.edu.br/acet/article/view/1083
  • Pedley, D. and Morgenroth, J. 2025. Detecting and measuring fine-scale urban tree canopy loss with deep learning and remote sensing. ISPRS Open Journal of Photogrammetry and Remote Sensing , 15, 100082. https://doi.org/10.1016/j.ophoto.2025.100082
    » https://doi.org/https://doi.org/10.1016/j.ophoto.2025.100082
  • Silva, C. de S., Viegas, I., Panagopoulos, T. and Bell, S. 2018. Environmental Justice in Accessibility to Green Infrastructure in Two European Cities. Land, 7(4), 134. https://doi.org/10.3390/land7040134
    » https://doi.org/https://doi.org/10.3390/land7040134
  • Weinstein, B. G., Marconi, S., Bohlman, S. A., Zare, A. and White, E. P. 2020. Cross-site learning in deep learning RGB tree crown detection. Ecological Informatics, 56, 101061. https://doi.org/10.1016/j.ecoinf.2020.101061
    » https://doi.org/https://doi.org/10.1016/j.ecoinf.2020.101061
  • Yang, L., Ge, J., Cao, Y., Liu, Y., Luo, X., Wang, S. and Guo, W. 2024. Enhanced Cooling Efficiency of Urban Trees on Hotter Summer Days in 70 Cities of China. Advances in Atmospheric Sciences, 41, pp. 2259-2275. https://doi.org/10.1007/s00376-024-3269-9
    » https://doi.org/https://doi.org/10.1007/s00376-024-3269-9
  • Zölch, T., Rahman, M. A., Pfleiderer, E., Wagner, G. and Pauleit, S. 2019. Designing public squares with green infrastructure to optimize human thermal comfort. Building and Environment, 149, pp. 640-654. https://doi.org/10.1016/j.buildenv.2018.12.051
    » https://doi.org/https://doi.org/10.1016/j.buildenv.2018.12.051

DATA AVAILABILITY

The high-resolution aerial images used in this study are proprietary data owned by the Instituto Geográfico e Cartográfico do Estado de São Paulo (IGC-SP) and its private partners, and cannot be shared publicly. The deep learning models were trained and executed using proprietary software (ArcGIS Pro), precluding the distribution of source code and model weights.

SUPPLEMENTARY MATERIAL

The spatial distribution was further explored with the Tree Cover Density Map of Tarabai-SP using Kernel density estimation (Figure 9). This heatmap clearly identifies vegetation “hotspots” and “green deserts”. The main high-density nuclei are concentrated in the southeastern portion, corresponding to neighborhoods with larger lots and older vegetation, and along riparian corridors bordering the urban perimeter. Conversely, a prominent “green desert” is located in the northeastern sector, an area of recent urban expansion, highlighting it as a critical area for future planting policies.

Figure 10:
Tree Cover Density Map of the municipality of Tarabai-SP.

At the block level, the Map of Tree Area per Urban Block (Figure 10) reveals a notably unequal distribution. A few blocks, particularly on the western edge, act as significant vegetation “reservoirs”, concentrating the largest tree areas. In contrast, the majority of blocks, especially in the eastern half, show a scarcity of large-scale tree cover.

Figure 11:
Map of Tree Cover Area per Urban Block in Tarabai-SP.

Finally, to assess the distribution from the perspective of public access and environmental justice, a Map of Accessibility to Main Green Areas was created (Figure 11). Based on walkability studies (SILVA et al., 2018), 300m and 500m influence areas were generated from the three largest tree fragments. The map shows that while the central and western portions of the town are well-served, there are significant access gaps in the northeastern and southeastern sectors, where residents are beyond a recommended 500-meter distance from the main green nuclei.

Figure 12:
Map of Accessibility to Main Green Areas in Tarabai-SP.

Edited by

Jorge Antônio Silva Centeno and Silvana Philippi Camboim.

Publication Dates

  • Publication in this collection
    16 Nov 2026
  • Date of issue
    2026

History

  • Received
    05 Nov 2025
  • Accepted
    30 Sept 2026
location_on
Universidade Federal do Paraná Centro Politécnico, Jardim das Américas, 81531-990 Curitiba - Paraná - Brasil, Tel./Fax: (55 41) 3361-3637 - Curitiba - PR - Brazil
E-mail: bcg_editor@ufpr.br
rss_feed Stay informed of issues for this journal through your RSS reader
Go to top