A curated list of open technology projects to sustain a stable climate, energy supply, biodiversity and natural resources.

Detectree2

Automatic tree crown delineation based on the Detectron2 implementation of Mask R-CNN.
https://github.com/PatBall1/detectree2

Category: Biosphere
Sub Category: Forest Remote Sensing

Keywords

deep-learning detectron2 python pytorch

Last synced: about 2 hours ago
JSON representation

Repository metadata

Python package for automatic tree crown delineation based on the Detectron2 implementation of Mask R-CNN

README.md

License: MIT Detectree CI PEP8 DOI

Python package for automatic tree crown delineation in aerial RGB and multispectral imagery based on Mask R-CNN. Pre-trained models can be picked in the model_garden.
A tutorial on how to prepare data, train models and make predictions is available here. For questions, collaboration proposals and requests for data email James Ball. Some example data is available to download here.

Detectree2是一个基于Mask R-CNN的自动树冠检测与分割的Python包。您可以在model_garden中选择预训练模型。这里提供了如何准备数据、训练模型和进行预测的教程。如果有任何问题,合作提案或者需要样例数据,可以邮件联系James Ball。一些示例数据可以在这里下载。

Code developed by James Ball, Seb Hickman, Thomas Koay, Oscar Jiang, Luran Wang, Panagiotis Ioannou, James Hinton and Matthew Archer in the Forest Ecology and Conservation Group at the University of Cambridge. The Forest Ecology and Conservation Group is led by Professor David Coomes and is part of the University of Cambridge Conservation Research Institute.

Citation

Please cite this article if you use detectree2 in your work:

Ball, J.G.C., Hickman, S.H.M., Jackson, T.D., Koay, X.J., Hirst, J., Jay, W., Archer, M., Aubry-Kientz, M., Vincent, G. and Coomes, D.A. (2023),
Accurate delineation of individual tree crowns in tropical forests from aerial RGB imagery using Mask R-CNN.
Remote Sens Ecol Conserv. 9(5):641-655. https://doi.org/10.1002/rse2.332

Independent validation

Independent validation has been performed on a temperate deciduous forest in Japan.

Detectree2 (F1 score: 0.57) outperformed DeepForest (F1 score: 0.52)

Detectree2 could estimate tree crown areas accurately, highlighting its potential and robustness for tree detection and delineation

Gan, Y., Wang, Q., and Iio, A. (2023).
Tree Crown Detection and Delineation in a Temperate Deciduous Forest from UAV RGB Imagery Using Deep Learning Approaches: Effects of Spatial Resolution and Species Characteristics.
Remote Sensing. 15(3):778. https://doi.org/10.3390/rs15030778

Requirements

e.g.
pip3 install torch torchvision torchaudio

Installation

pip

pip install git+https://github.com/PatBall1/detectree2.git

Currently works on Google Colab (Pro version recommended). May struggle on clusters if geospatial libraries are not configured.
See Installation Instructions if you are having trouble.

conda

Under development

Getting started

Detectree2, based on the Detectron2 Mask R-CNN architecture, locates
trees in aerial images. It has been designed to delineate trees in challenging dense tropical forests for a range of
ecological applications.

This tutorial takes you through the key steps.
Example Colab notebooks are also available but are
not updated frequently so functions and parameters may need to be adjusted to get things working properly.

The standard workflow includes:

  1. Tile the orthomosaics and crown data (for training, validation and testing)
  2. Train (and tune) a model on the training tiles
  3. Evaluate the model performance by predicting on the test tiles and comparing to manual crowns for the tiles
  4. Using the trained model to predict the crowns over the entire region of interest

Training crowns are used to teach the network to delineate tree crowns.

Here is an example image of the predictions made by Detectree2.

Applications

Tracking tropical tree growth and mortality

Counting urban trees (Buffalo, NY)

Multi-temporal tree crown segmentation

Liana detection and infestation mapping

In development

Tree species identification and mapping

In development

To do

  • Functions for multiple labels vs single "tree" label

Project Organization

├── LICENSE
├── Makefile
├── README.md
├── detectree2
│   ├── data_loading
│   ├── models
│   ├── preprocessing
│   ├── R
│   └── tests
├── docs
│   └── source
├── model_garden
├── notebooks
│   ├── colab
│   ├── colabJB
│   ├── colabJH
│   ├── colabKoay
│   ├── colabPan
│   ├── colabSeb
│   ├── exploratory
│   ├── mask_rcnn
│   │   ├── testing
│   │   └── training
│   ├── reports
│   └── turing
├── report
│   ├── figures
│   └── sections
└── requirements

Code formatting

To automatically format your code, make sure you have black installed (pip install black) and call
black .
from within the project directory.


Copyright (c) 2022, James G. C. Ball


Owner metadata


GitHub Events

Total
Last Year

Committers metadata

Last synced: 5 days ago

Total Commits: 355
Total Committers: 11
Avg Commits per committer: 32.273
Development Distribution Score (DDS): 0.414

Commits in past year: 39
Committers in past year: 3
Avg Commits per committer in past year: 13.0
Development Distribution Score (DDS) in past year: 0.385

Name Email Commits
Ball JGC b****c@g****m 208
James Ball j****3@s****k 66
James-Hirst-1998 h****j@g****m 24
Christopher Kotthoff c****7@r****m 24
Matthew Archer m****5@c****k 19
Charles Song c****g@g****m 4
Paul Tresson p****n@c****r 3
Seb Hickman 5****0 2
Puming (Oscar) Jiang 1****g 2
Andrés Camilo Zúñiga-González 3****o 2
ai4er-cookiecutter c****r@h****g 1

Committer domains:


Issue and Pull Request metadata

Last synced: 1 day ago

Total issues: 100
Total pull requests: 102
Average time to close issues: 4 months
Average time to close pull requests: about 1 month
Total issue authors: 30
Total pull request authors: 11
Average comments per issue: 2.0
Average comments per pull request: 0.31
Merged pull request: 75
Bot issues: 0
Bot pull requests: 0

Past year issues: 30
Past year pull requests: 30
Past year average time to close issues: 16 days
Past year average time to close pull requests: 4 days
Past year issue authors: 12
Past year pull request authors: 3
Past year average comments per issue: 2.33
Past year average comments per pull request: 0.13
Past year merged pull request: 27
Past year bot issues: 0
Past year bot pull requests: 0

More stats: https://issues.ecosyste.ms/repositories/lookup?url=https://github.com/PatBall1/detectree2

Top Issue Authors

  • ma595 (28)
  • PatBall1 (19)
  • CiSong10 (7)
  • xabierr (4)
  • ChristopherKotthoff (4)
  • yby026 (3)
  • rjstack266 (3)
  • aloboa (3)
  • chenyuanyuan12138 (3)
  • DrawingWorkerChi (2)
  • Theodore1999 (2)
  • Coder-GAN (2)
  • ancazugo (2)
  • Joda0515 (2)
  • ambarwariagus (1)

Top Pull Request Authors

  • PatBall1 (35)
  • ChristopherKotthoff (23)
  • ma595 (22)
  • 0scarJ1ang (7)
  • James-Hirst-1998 (4)
  • CiSong10 (3)
  • WangLuran (3)
  • ancazugo (2)
  • zeppehpt1 (1)
  • mpcabete (1)
  • ptresson (1)

Top Issue Labels

  • enhancement (10)
  • bug (7)
  • build (7)
  • documentation (5)
  • testing (1)
  • performance (1)
  • help wanted (1)

Top Pull Request Labels

  • build (4)
  • documentation (3)
  • enhancement (1)

Package metadata

pypi.org: detectree2

Detectree packaging

  • Homepage: https://github.com/PatBall1/detectree2
  • Documentation: https://detectree2.readthedocs.io/
  • Licenses: mit
  • Latest release: 0.0.1 (published over 2 years ago)
  • Last Synced: 2025-04-27T13:04:25.887Z (about 2 hours ago)
  • Versions: 1
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 37 Last month
  • Rankings:
    • Dependent packages count: 6.633%
    • Forks count: 10.336%
    • Stargazers count: 15.288%
    • Average: 24.269%
    • Dependent repos count: 30.611%
    • Downloads: 58.475%
  • Maintainers (1)

Dependencies

.github/workflows/docker-test.yml actions
  • GuillaumeFalourd/clone-github-repo-action v2 composite
  • actions/checkout v3 composite
.github/workflows/python-ci.yml actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/sphinx-ci.yml actions
  • actions/checkout v3 composite
  • actions/upload-artifact v3 composite
  • peaceiris/actions-gh-pages v3 composite
docker/Dockerfile docker
  • nvidia/cuda 11.1.1-cudnn8-devel-ubuntu20.04 build
docs/requirements.txt pypi
  • jinja2 ==3.0.3
requirements/dev-requirements.txt pypi
  • black * development
  • flake8 * development
  • flake8-docstrings * development
  • isort * development
  • mypy * development
  • python-dotenv * development
requirements/requirements.txt pypi
  • Fiona ==1.8.21
  • Markdown ==3.3.6
  • Pillow ==9.0.1
  • PyCRS ==1.0.2
  • PyYAML ==5.1
  • Rtree ==0.9.7
  • Shapely ==1.8.1.post1
  • Werkzeug ==2.0.3
  • absl-py ==1.0.0
  • affine ==2.3.0
  • antlr4-python3-runtime ==4.8
  • appdirs ==1.4.4
  • attrs ==21.4.0
  • black ==21.4b2
  • cachetools ==5.0.0
  • certifi ==2021.10.8
  • charset-normalizer ==2.0.12
  • click ==8.0.4
  • click-plugins ==1.1.1
  • cligj ==0.7.2
  • cloudpickle ==2.0.0
  • cycler ==0.11.0
  • descartes ==1.1.0
  • detectron2 ==0.6
  • flake8 ==4.0.1
  • fonttools ==4.30.0
  • future ==0.18.2
  • fvcore ==0.1.5.post20220305
  • geopandas ==0.10.2
  • google-auth ==2.6.0
  • google-auth-oauthlib ==0.4.6
  • grpcio ==1.44.0
  • hydra-core ==1.1.1
  • idna ==3.3
  • importlib-metadata ==4.11.3
  • importlib-resources ==5.4.0
  • iopath ==0.1.9
  • kiwisolver ==1.4.0
  • matplotlib ==3.5.1
  • mccabe ==0.6.1
  • munch ==2.5.0
  • mypy-extensions ==0.4.3
  • numpy ==1.22.3
  • oauthlib ==3.2.0
  • omegaconf ==2.1.1
  • opencv-python ==4.5.5.64
  • packaging ==21.3
  • pandas ==1.4.1
  • pathspec ==0.9.0
  • portalocker ==2.4.0
  • protobuf ==3.19.4
  • pyasn1 ==0.4.8
  • pyasn1-modules ==0.2.8
  • pycocotools ==2.0.4
  • pycodestyle ==2.8.0
  • pydot ==1.4.2
  • pyflakes ==2.4.0
  • pygeos ==0.12.0
  • pyparsing ==3.0.7
  • pypng ==0.0.21
  • pyproj ==3.3.0
  • pytz ==2021.3
  • rasterio ==1.2.10
  • regex ==2022.3.15
  • requests ==2.27.1
  • requests-oauthlib ==1.3.1
  • rsa ==4.8
  • snuggs ==1.4.7
  • tabulate ==0.8.9
  • tensorboard ==2.8.0
  • tensorboard-data-server ==0.6.1
  • tensorboard-plugin-wit ==1.8.1
  • termcolor ==1.1.0
  • toml ==0.10.2
  • torch ==1.9.0
  • torchvision ==0.10.0
  • tqdm ==4.63.0
  • typing_extensions ==4.1.1
  • urllib3 ==1.26.9
  • yacs ==0.1.8
  • zipp ==3.7.0
requirements/test-requirements.txt pypi
  • click * test
  • coverage * test
  • flake8 * test
  • python-dotenv * test
  • sphinx * test
  • virtualenv * test
setup.py pypi
  • GDAL >=1.11
  • descartes *
  • detectron2 *
  • fiona *
  • geopandas *
  • geos *
  • proj *
  • pycrs *
  • pygeos *
  • pypng *
  • pyyaml ==5.1
  • rasterio ==1.3a3
requirements/environment.yml pypi
  • hydra-core *

Score: 11.473560741447951