{"id":15066208,"url":"https://github.com/patball1/detectree2","last_synced_at":"2025-05-16T08:04:35.850Z","repository":{"id":38033165,"uuid":"470698486","full_name":"PatBall1/detectree2","owner":"PatBall1","description":"Python package for automatic tree crown delineation based on the Detectron2 implementation of Mask R-CNN","archived":false,"fork":false,"pushed_at":"2025-04-17T14:55:57.000Z","size":163197,"stargazers_count":190,"open_issues_count":43,"forks_count":46,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-05-11T20:04:47.428Z","etag":null,"topics":["deep-learning","detectron2","python","pytorch"],"latest_commit_sha":null,"homepage":"https://patball1.github.io/detectree2/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/PatBall1.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-03-16T18:05:41.000Z","updated_at":"2025-05-01T09:34:55.000Z","dependencies_parsed_at":"2023-09-21T20:04:15.083Z","dependency_job_id":"3ec77801-e080-4d50-a5be-4d3b562957fd","html_url":"https://github.com/PatBall1/detectree2","commit_stats":{"total_commits":326,"total_committers":10,"mean_commits":32.6,"dds":0.3742331288343558,"last_synced_commit":"1823cd704a45ba4a0cc606bbfcfdcce5e4bba4d5"},"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatBall1%2Fdetectree2","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatBall1%2Fdetectree2/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatBall1%2Fdetectree2/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/PatBall1%2Fdetectree2/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/PatBall1","download_url":"https://codeload.github.com/PatBall1/detectree2/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254493378,"owners_count":22080126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deep-learning","detectron2","python","pytorch"],"created_at":"2024-09-25T01:03:46.522Z","updated_at":"2025-05-16T08:04:35.800Z","avatar_url":"https://github.com/PatBall1.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"left\"\u003e\n\u003cimg width=\"350\" alt=\"predictions\" src= ./.github/logo.png#gh-light-mode-only\u003e\n\u003cimg width=\"350\" alt=\"predictions\" src= ./.github/logo_dark.png#gh-dark-mode-only\u003e\n\u003c/p\u003e\n\n\n [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) [![Detectree CI](https://github.com/patball1/detectree2/actions/workflows/python-ci.yml/badge.svg)](https://github.com/patball1/detectree2/actions/workflows/python-ci.yml) [![PEP8](https://img.shields.io/badge/code%20style-pep8-orange.svg)](https://www.python.org/dev/peps/pep-0008/) [![DOI](https://zenodo.org/badge/470698486.svg)](https://zenodo.org/badge/latestdoi/470698486)\n\n\n\u003c!-- \u003ca href=\"https://github.com/hhatto/autopep8\"\u003e\u003cimg alt=\"Code style: autopep8\" src=\"https://img.shields.io/badge/code%20style-autopep8-000000.svg\"\u003e\u003c/a\u003e --\u003e\n\n\nPython 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`](https://github.com/PatBall1/detectree2/tree/master/model_garden).\nA tutorial on how to prepare data, train models and make predictions is available [here](https://patball1.github.io/detectree2/tutorial.html). For questions, collaboration proposals and requests for data email [James Ball](mailto:ball.jgc@gmail.com). Some example data is available to download [here](https://doi.org/10.5281/zenodo.8136161).\n\nDetectree2是一个基于Mask R-CNN的自动树冠检测与分割的Python包。您可以在[`model_garden`](https://github.com/PatBall1/detectree2/tree/master/model_garden)中选择预训练模型。[这里](https://patball1.github.io/detectree2/tutorial.html)提供了如何准备数据、训练模型和进行预测的教程。如果有任何问题，合作提案或者需要样例数据，可以邮件联系[James Ball](mailto:ball.jgc@gmail.com)。一些示例数据可以在[这里](https://doi.org/10.5281/zenodo.8136161)下载。\n\n| \u003ca href=\"https://www.conservation.cam.ac.uk/\"\u003e\u003cimg src=\"./report/cam_logo.png\" width=\"140\"\u003e\u003c/a\u003e | \u003csup\u003e 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](https://coomeslab.org/) 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](https://www.conservation.cam.ac.uk/). \u003c/sup\u003e|\n| :---: | :--- |\n\n\n## Citation\n\nPlease cite this article if you use _detectree2_ in your work:\n\nBall, 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),\nAccurate delineation of individual tree crowns in tropical forests from aerial RGB imagery using Mask R-CNN.\n*Remote Sens Ecol Conserv*. 9(5):641-655. [https://doi.org/10.1002/rse2.332](https://doi.org/10.1002/rse2.332)\n\n## Independent validation\n\nIndependent validation has been performed on a temperate deciduous forest in Japan.\n\n\u003e *Detectree2 (F1 score: 0.57) outperformed DeepForest (F1 score: 0.52)*\n\u003e\n\u003e *Detectree2 could estimate tree crown areas accurately, highlighting its potential and robustness for tree detection and delineation*\n\nGan, Y., Wang, Q., and Iio, A. (2023).\nTree Crown Detection and Delineation in a Temperate Deciduous Forest from UAV RGB Imagery Using Deep Learning Approaches: Effects of Spatial Resolution and Species Characteristics. \n*Remote Sensing*. 15(3):778. [https://doi.org/10.3390/rs15030778](https://doi.org/10.3390/rs15030778)\n\n## Requirements\n\n- Python 3.8+\n- [gdal](https://gdal.org/download.html) geospatial libraries\n- [PyTorch ≥ 1.8 and torchvision](https://pytorch.org/get-started/previous-versions/) versions that match\n- For training models GPU access (with CUDA) is recommended\n\ne.g.\n```pip3 install torch torchvision torchaudio```\n\n## Installation\n\n### pip\n\n```pip install git+https://github.com/PatBall1/detectree2.git```\n\nCurrently works on Google Colab (Pro version recommended). May struggle on clusters if geospatial libraries are not configured.\nSee [Installation Instructions](https://patball1.github.io/detectree2/installation.html) if you are having trouble.\n\n### conda\n\n*Under development*\n\n## Getting started\n\nDetectree2, based on the [Detectron2](https://github.com/facebookresearch/detectron2) Mask R-CNN architecture, locates\ntrees in aerial images. It has been designed to delineate trees in challenging dense tropical forests for a range of\necological applications.\n\nThis [tutorial](https://patball1.github.io/detectree2/tutorial.html) takes you through the key steps.\n[Example Colab notebooks](https://github.com/PatBall1/detectree2/tree/master/notebooks/colab) are also available but are\nnot updated frequently so functions and parameters may need to be adjusted to get things working properly.\n\nThe standard workflow includes:\n\n1) Tile the orthomosaics and crown data (for training, validation and testing)\n2) Train (and tune) a model on the training tiles\n3) Evaluate the model performance by predicting on the test tiles and comparing to manual crowns for the tiles\n4) Using the trained model to predict the crowns over the entire region of interest\n\nTraining crowns are used to teach the network to delineate tree crowns.\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"500\" align=\"center\" alt=\"predictions\" src= ./report/figures/Workflow_Diagram2_a.png#gh-light-mode-only\u003e\n\u003cimg width=\"500\" align=\"center\" alt=\"predictions\" src= ./report/figures/Workflow_Diagram2_b.png#gh-dark-mode-only\u003e\n\u003c/p\u003e\n\nHere is an example image of the predictions made by Detectree2.\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"700\" align=\"center\" alt=\"predictions\" src= ./report/figures/prediction_paracou.png \u003e\n\u003c/p\u003e\n\n## Applications\n\n### Tracking tropical tree growth and mortality\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"500\" alt=\"predicting\" src= ./report/figures/growth_mortality_bootstrap.png \u003e\n\u003c/p\u003e\n\n### Counting urban trees (Buffalo, NY)\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"700\" alt=\"predicting\" src= ./report/figures/urban.png \u003e\n\u003c/p\u003e\n\n### Multi-temporal tree crown segmentation\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"700\" alt=\"predicting\" src= ./report/figures/seg.gif \u003e\n\u003c/p\u003e\n\n### Liana detection and infestation mapping\n\n*In development*\n\n\u003cp align=\"center\"\u003e\n\u003cimg width=\"700\" alt=\"predicting\" src= ./report/figures/Lianas_detect.jpg \u003e\n\u003c/p\u003e\n\n### Tree species identification and mapping\n\n*In development*\n\n## To do\n\n- Functions for multiple labels vs single \"tree\" label\n\n## Project Organization\n\n```\n├── LICENSE\n├── Makefile\n├── README.md\n├── detectree2\n│   ├── data_loading\n│   ├── models\n│   ├── preprocessing\n│   ├── R\n│   └── tests\n├── docs\n│   └── source\n├── model_garden\n├── notebooks\n│   ├── colab\n│   ├── colabJB\n│   ├── colabJH\n│   ├── colabKoay\n│   ├── colabPan\n│   ├── colabSeb\n│   ├── exploratory\n│   ├── mask_rcnn\n│   │   ├── testing\n│   │   └── training\n│   ├── reports\n│   └── turing\n├── report\n│   ├── figures\n│   └── sections\n└── requirements\n```\n\n## Code formatting\n\nTo automatically format your code, make sure you have `black` installed (`pip install black`) and call\n```black .```\nfrom within the project directory.\n\n---\n\nCopyright (c) 2022, James G. C. Ball\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatball1%2Fdetectree2","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpatball1%2Fdetectree2","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpatball1%2Fdetectree2/lists"}