• Stars
    star
    156
  • Rank 239,589 (Top 5 %)
  • Language
    Jupyter Notebook
  • License
    MIT License
  • Created over 2 years ago
  • Updated 3 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

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

predictions predictions

License: MIT Detectree CI PEP8 DOI

Python package for automatic tree crown delineation 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 for 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.



Note

To save bandwidth trained models have been moved to Zenodo. Download models directly with wget or equivalent.

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.

predictions predictions

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

predictions

Applications

Tracking tropical tree growth and mortality

predicting

Counting urban trees (Buffalo, NY)

predicting

Multi-temporal tree crown segmentation

predicting

Liana detection and infestation mapping

In development

predicting

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