YOLOv8 tree detection model: Quantifying visible green for health studies
Authors/Creators
Description
Green space plays a critical role in providing benefits for public health. More specifically, having views of nature and vegetation has been shown to improve mental health and well-being. Currently in the field of environmental epidemiology, studies quantifying visible green use viewshed analyses to calculate the percentage of green pixels within a view to estimate total visible green. Utilizing object detection, namely YOLOv8, we aim to quantify trees at an individual level. This tree detection model was trained on single-direction stingle-view Google Streeet View (GSV) images, randomly selected within Western Europe and depicting different species of trees across all seasonal stages. Training was performed using Python (version 3.10.9) and Ultralytics YOLOv8.1.16. Default hyperparameters with image size 640 were used on 1106 labeled training images and validation was performed on 200 images. This model resulted in precision (P) = 0.824, recall (R) = 0.727, and mean average precision (mAP50) = 0.823.
This model was used in a study examining the "3+30+300 rule" (Konijnendijk, 2022) surrounding 264,622 buildings in Flanders, Belgium (Lee et al., 2026). The model performed well and the spatial patterns observed in the visible tree data were confirmed by tree canopy cover data. An accuracy assessment was performed on a selection of urban, suburban, and rural classified GSV panoramas with "dense green" (e.g. forested or dense tree views) and "sparse green" (e.g. built-up surfaces with few solitary trees) views (n= 200 images per condition). Default hyper parameters with image size 2080 were used for validation. Figure 1 demonstrates labeled images of each condition and the resulting true positive (TP) and false negative (FN) results. Overall assessment of the accuracy revealed better performance in built-up areas, where street trees are more easily distinguishable, especially when silhouetted against buildings and other infrastructure. However, the model tends to undercount trees in dense green views dominated by urban forests or dense vegetation due to the detection of many trees as background (i.e. high FN scores of dense green condition).
It is important to note that the model was trained on undistorted single-view single-direction GSV images, while the accuracy assessment and object detection used within the study were performed on distorted GSV panorama (360°) images. Though this model was trained on images without distortion, it still performed well when applied to images with distortion (i.e. panoramas).
Limitations still exist with this technology. See Bijlecki & Ito, 2021. When paired with street view images, this methodology is limited to views at the street level. This means that 'hidden' green - green space not visible from the street but still seen or experienced by residents from their homes, e.g. private backyard gardens - is not taken into account. Additionally, it does not take into account the wider views of residents living on higher floors of taller buildings. Therefore, results from this YOLOv8 tree detection model may underestimate the visible green of residents.
Despite these limitations, this tree detection model offers a scalable approach to counting trees, which reduces the need for intensive manual surveys and biophysical tree measurements. It is easily applicable to RGB image datasets, single street view images, and panoramas. The ZIP file includes 4 files: "customdog.jpg" and "yolov8n.pt" are included to load the basic YOLOv8 models and run initial checks, "Yolov8_TreeDetection_zenodo.ipynb" shows the basic Python script need to run YOLO, "treedetect.pt" is the trained tree detection model described here. Note that in order to use the model, you need to compile your own dataset of images.
For more information about the tree detection model, contact Melissa Lee (melissa.lee@kuleuven.be). If using our work in your scientific publication, please cite our work:
Lee, M., Aerts, R., Somers, B., & Van Orshoven, J. (2025). YOLOv8 tree detection model: Quantifying visible green for health studies. Zenodo. https://doi.org/10.5281/zenodo.14512739
Files
Figure1.png
Files
(13.1 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:2971b5b44ef3f796dd560fee116e3f53
|
1.3 MB | Preview Download |
|
md5:22e8705ee38abbfbb47c49fa4cc6d769
|
11.7 MB | Preview Download |
Additional details
Funding
- Research Foundation - Flanders
- PhD Fellowship strategic basic research 1SH0G24N
Software
- Programming language
- Python