--- license: mit language: - en tags: - deepforest - object-detection - tree-crown-detection library_name: deepforest pipeline_tag: object-detection --- ## Tree Crown Detection in RGB Airborne Imagery DeepForest's default tree crown detector: a RetinaNet with a ResNet-50 FPN backbone that predicts one bounding box per tree crown in RGB aerial and drone imagery. The model was initially described in [Remote Sensing](https://www.mdpi.com/2072-4292/11/11/1309) on a single site. Comparisons among geographic sites were added to [Ecological Informatics](https://www.sciencedirect.com/science/article/pii/S157495412030011X). The model was further improved, and the Python package was released in [Methods in Ecology and Evolution](https://besjournals.onlinelibrary.wiley.com/doi/full/10.1111/2041-210X.13472). ### This version: fine-tuned on MillionTrees These weights are the earlier NEON tree model fine-tuned on the [MillionTrees](https://milliontrees.idtrees.org) TreeBoxes v0.25 within-distribution train split: about 13,600 images and 796,000 boxes from 15 sources across many biomes, drone and airborne platforms, and resolutions. The checkpoint was selected on box F1 on the held-out validation split. The earlier NEON-only weights are still in this repository's history; load them with `revision=` set to the commit before this one. ### Usage ```python from deepforest import main model = main.deepforest(config_args={"nms_thresh": 0.2, "score_thresh": 0.2}) model.load_model("weecology/deepforest-tree") boxes = model.predict_tile("image.tif", patch_size=400, patch_overlap=0.1) ``` DeepForest's config sets `nms_thresh` and `score_thresh` when the model loads. This model was evaluated at **NMS 0.2, score 0.2**; at the package default of NMS 0.05, recall drops noticeably on dense canopies. ### Performance (MillionTrees TreeBoxes v0.25 test) Predictions are matched to ground truth at IoU 0.4. AP40 is scored with up to 1000 detections per image. | Split | Model | Recall | Mask-aware precision | F1 | AP40 | AP60 | |---|---|---|---|---|---|---| | Within-distribution | previous `deepforest-tree` (NEON) | 0.415 | 0.639 | 0.503 | 0.260 | 0.091 | | Within-distribution | **this model** | 0.725 | 0.814 | 0.767 | 0.562 | 0.445 | | Out-of-distribution* | previous `deepforest-tree` (NEON) | 0.540 | 0.781 | 0.638 | 0.298 | 0.123 | | Out-of-distribution* | same recipe, OOD-trained | 0.738 | 0.913 | 0.816 | 0.520 | 0.354 | \*The out-of-distribution row is a separate checkpoint trained with the same recipe but with whole sources held out. It shows how the recipe does on sources it never saw. These weights were trained on the within-distribution split. ### Figures ![F1 and AP40 for the previous release, the ResNet-50 fine-tune and the DINOv3 fine-tune](figures/E014_macro.png) Macro-averaged over sources on the MillionTrees TreeBoxes v0.25 test splits. The out-of-distribution bars come from checkpoints trained with whole sources held out. ![Per-source F1 on the within-distribution test split](figures/E014_per_source_f1_wd.png) Per source on the within-distribution test split. The new models improve on the NEON release everywhere except NEON MultiTemporal, where all three are close. The largest gains are on sources unlike NEON: drone imagery, palms, tropical forest and urban trees. ![Predictions on held-out test tiles](figures/E014_overlays_wd.png) The same held-out test tile for each model; purple is ground truth and orange is prediction. Rows are the six largest test sources, each showing the image with that source's median number of trees, so the tiles were not picked for gain. Some sources label only some of the trees (for example OAM-TCD and the palm counting set), so an unmatched orange box is not always a false positive. For a stronger but heavier model, see `weecology/deepforest-tree-dinov3` (RetinaNet with a DINOv3 ViT-L backbone, which needs access to Meta's DINOv3 weights). ### Citation ```bibtex @article{weinstein2020deepforest, title={DeepForest: A Python package for RGB deep learning tree crown delineation}, author={Weinstein, Ben G and Marconi, Sergio and Aubry-Kientz, M{\'e}laine and Vincent, Gregoire and Senyondo, Henry and White, Ethan P}, journal={Methods in Ecology and Evolution}, volume={11}, number={12}, pages={1743--1751}, year={2020} } ```