DetecTree example

February 18, 2026 · View on GitHub

GitHub license Binder pre-commit.ci status

DetecTree example

Example computational workflows to classify tree/non-tree pixels in Zurich using DetecTree.

Citation

Bosch M. 2020. “DetecTree: Tree detection from aerial imagery in Python”. Journal of Open Source Software, 5(50), 2172. doi.org/10.21105/joss.02172

Notebooks

The notebooks are stored in the notebooks folder. If you have trouble reproducing them, see the "Instructions to reproduce" section below.

Pre-trained model

  • Pre-trained model: examples of using the pre-trained model to detect trees in aerial imagery from different sources.

Training

  • Aussersihl canopy: application of DetecTree to compute a tree canopy map for the Aussersihl district in Zurich.
  • Cluster-I: train/test split of image tiles based on k-means clustering of image descriptors to enhance the variety of scenes represented in the training tiles.

Out-of-date notebooks on other train/test split methods:

  • Baseline: train/test split of image tiles based on uniform sampling.
  • Cluster-II: train/test split of image tiles based on a two-level k-means clustering, using a separate classifier for each first-level cluster of tiles. The second-level clustering enhances the variety of scenes represented in the training tiles of each separate classifier.

Background

  • Background: overview of the methods used to detect tree/non-tree pixels, based on Yang et al. [1]

Instructions to reproduce

This setup uses pixi to manage dependencies. With pixi installed in your system, you can simply run pixi run python and you will get a Python shell session with all the dependencies available. In order to run notebooks within this environment, you can use pixi-kernel.

Acknowledgments

References

  1. Yang, L., Wu, X., Praun, E., & Ma, X. (2009). Tree detection from aerial imagery. In Proceedings of the 17th ACM SIGSPATIAL International Conference on Advances in Geographic Information Systems (pp. 131-137). ACM.