Image Classification
DeepForest
Safetensors
remote-sensing
aerial-imagery
forest
tree-mortality
ecology
model_hub_mixin
pytorch_model_hub_mixin
Instructions to use weecology/cropmodel-deadtrees with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- DeepForest
How to use weecology/cropmodel-deadtrees with DeepForest:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Retrained Alive/Dead model: deadtrees.earth pretraining + NEON hand labels + NEON field-survey crowns
#2
by bw4sz - opened
- .gitattributes +1 -0
- README.md +132 -6
- config.json +51 -10
- model.safetensors +1 -1
- pr_calibration.png +3 -0
.gitattributes
CHANGED
|
@@ -1 +1,2 @@
|
|
| 1 |
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 1 |
model.safetensors filter=lfs diff=lfs merge=lfs -text
|
| 2 |
+
pr_calibration.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,10 +1,136 @@
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
tags:
|
| 3 |
-
-
|
| 4 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
---
|
| 6 |
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
-
|
| 10 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: mit
|
| 3 |
+
library_name: deepforest
|
| 4 |
+
pipeline_tag: image-classification
|
| 5 |
tags:
|
| 6 |
+
- deepforest
|
| 7 |
+
- remote-sensing
|
| 8 |
+
- aerial-imagery
|
| 9 |
+
- forest
|
| 10 |
+
- tree-mortality
|
| 11 |
+
- ecology
|
| 12 |
+
- model_hub_mixin
|
| 13 |
+
- pytorch_model_hub_mixin
|
| 14 |
+
datasets:
|
| 15 |
+
- ayushi3536/deadtree.earth-aerial-train_cc_by
|
| 16 |
+
- ayushi3536/deadtree.earth-aerial-bench
|
| 17 |
+
metrics:
|
| 18 |
+
- roc_auc
|
| 19 |
+
- f1
|
| 20 |
---
|
| 21 |
|
| 22 |
+
# DeepForest Alive/Dead tree crown classifier
|
| 23 |
+
|
| 24 |
+
A ResNet-50 that classifies RGB crops of tree crowns as **Alive** or **Dead**. It is the
|
| 25 |
+
second stage of the [DeepForest](https://github.com/weecology/DeepForest) pipeline:
|
| 26 |
+
`weecology/deepforest-tree` finds crowns, and this model labels each one.
|
| 27 |
+
|
| 28 |
+
**Labels:** `{"Alive": 0, "Dead": 1}`. Input: RGB crown crop, resized to 224 × 224, ImageNet normalization.
|
| 29 |
+
|
| 30 |
+
## Usage
|
| 31 |
+
|
| 32 |
+
```python
|
| 33 |
+
from deepforest import main
|
| 34 |
+
from deepforest.model import CropModel
|
| 35 |
+
|
| 36 |
+
m = main.deepforest()
|
| 37 |
+
m.load_model("weecology/deepforest-tree")
|
| 38 |
+
crop_model = CropModel.load_model("weecology/cropmodel-deadtrees")
|
| 39 |
+
|
| 40 |
+
predictions = m.predict_tile(path="tile.tif", crop_model=crop_model)
|
| 41 |
+
# predictions has cropmodel_label ("Alive"/"Dead") and cropmodel_score per crown
|
| 42 |
+
```
|
| 43 |
+
|
| 44 |
+
The Dead probability is reasonably calibrated. Raise the threshold to about 0.7 if false
|
| 45 |
+
alarms cost more than missed dead trees, or lower it to find more dead trees (see Evaluation).
|
| 46 |
+
|
| 47 |
+
## Training
|
| 48 |
+
|
| 49 |
+
Two stages, both with Adam (lr 1e-4) and the checkpoint with the lowest validation loss. Fine-tuning reaches its lowest
|
| 50 |
+
validation loss after one epoch.
|
| 51 |
+
|
| 52 |
+
1. **Pretraining on deadtrees.earth crowns (weak labels).** About 250,000 crowns from
|
| 53 |
+
[DTE-aerial-train](https://huggingface.co/datasets/ayushi3536/deadtree.earth-aerial-train_cc_by)
|
| 54 |
+
(CC BY 4.0 part, 0.1 m, 1,617 orthophotos worldwide). DeepForest detected crowns on each patch.
|
| 55 |
+
A crown is **Dead** when at least 50% of its box is mapped as tree mortality, and **Alive** when its
|
| 56 |
+
box has no mortality and at least 70% tree cover. The masks are model-assisted pseudo-labels.
|
| 57 |
+
Train and validation are split by orthophoto.
|
| 58 |
+
2. **Fine-tuning on NEON crowns (8,449 crowns, 2,014 Dead), all 0.1 m [NEON](https://www.neonscience.org) RGB.**
|
| 59 |
+
- *Hand labels:* 6,329 hand-labelled crowns (5,358 Alive, 971 Dead) from 41 sites. They are split into
|
| 60 |
+
train, validation and test by 1 km tile, so no tile appears in two splits. 47 images labelled both
|
| 61 |
+
Alive and Dead were removed.
|
| 62 |
+
- *Field-survey crowns, checked by a person:* 2,120 crowns (1,077 Alive, 1,043 Dead) of 1,030 trees at
|
| 63 |
+
33 sites, all in train. Trees recorded as standing dead (or alive before they died) in the NEON
|
| 64 |
+
Woody Vegetation Structure survey (RELEASE-2026) were placed from their mapped stem locations and
|
| 65 |
+
matched to the nearest detected crown in every RGB flight from 2014 to 2026. Crowns whose lidar
|
| 66 |
+
canopy height disagreed with the field height were dropped. A person then reviewed 6,538 crowns and
|
| 67 |
+
deleted the obvious mistakes, mostly live canopy over a dead understorey stem (81% of the Dead
|
| 68 |
+
candidates). Tiles in the hand-label validation and test splits were excluded.
|
| 69 |
+
|
| 70 |
+
The full pipeline, from raw sources to this checkpoint, is in
|
| 71 |
+
[`scripts/alive_dead`](https://github.com/weecology/DeepForest/tree/main/scripts/alive_dead).
|
| 72 |
+
|
| 73 |
+
## Evaluation
|
| 74 |
+
|
| 75 |
+
Two test sets, neither used in training:
|
| 76 |
+
|
| 77 |
+
- **NEON test:** 882 hand-labelled crowns (136 Dead) from 25 held-out 1 km tiles.
|
| 78 |
+
- **DTE benchmark:** 2,841 crowns from the 25 expert-labelled sites of
|
| 79 |
+
[DTE-aerial-bench](https://huggingface.co/datasets/ayushi3536/deadtree.earth-aerial-bench) (10 cm patches),
|
| 80 |
+
labelled from the expert masks with the same rule as in pretraining.
|
| 81 |
+
|
| 82 |
+
| Model | NEON AUROC | NEON AP | NEON Dead F1 | DTE AUROC | DTE AP | DTE Dead F1 |
|
| 83 |
+
|---|---|---|---|---|---|---|
|
| 84 |
+
| Previous release (Oct 2025, NEON hand labels) | n/a\* | n/a\* | n/a\* | 0.935 | 0.899 | 0.71 |
|
| 85 |
+
| NEON hand labels only, tile-grouped split | 0.965 | 0.931 | 0.87 | 0.930 | 0.865 | 0.47 |
|
| 86 |
+
| deadtrees.earth pretraining + NEON hand labels | 0.985 | 0.950 | 0.87 | 0.983 | 0.971 | 0.84 |
|
| 87 |
+
| **This model** (deadtrees.earth pretraining + NEON hand labels + field-survey crowns) | 0.974 | 0.931 | 0.85 | **0.989** | **0.980** | **0.93** |
|
| 88 |
+
|
| 89 |
+
Dead F1 is at a 0.5 threshold. \*The previous release was trained on 88% of the current NEON test crops, so its NEON score is not comparable.
|
| 90 |
+
|
| 91 |
+
Adding the field-survey crowns lowers NEON test AP slightly (0.950 to 0.931; a paired bootstrap puts the difference at -0.035 to -0.005)
|
| 92 |
+
and raises Dead recall on the DTE benchmark from 0.73 to 0.92 at a 0.5 threshold.
|
| 93 |
+
|
| 94 |
+
**Calibration.** The previous release scores almost every crown 0 or 1: on the DTE benchmark, 86% of its wrong calls have a confidence above 0.99 (log loss 1.46).
|
| 95 |
+
For this model it is 10% (log loss 0.11, expected calibration error 0.015), so its Dead probability can be used as a probability.
|
| 96 |
+
On NEON test it slightly overcalls Dead between 0.5 and 0.7, where about 30% of crowns are dead.
|
| 97 |
+
|
| 98 |
+
| Threshold | NEON recall | NEON precision | DTE recall | DTE precision |
|
| 99 |
+
|---|---|---|---|---|
|
| 100 |
+
| 0.7 | 0.82 | 0.92 | 0.88 | 0.97 |
|
| 101 |
+
| 0.5 | 0.87 | 0.83 | 0.92 | 0.94 |
|
| 102 |
+
| 0.3 | 0.92 | 0.74 | 0.94 | 0.91 |
|
| 103 |
+
| 0.2 | 0.94 | 0.69 | 0.95 | 0.89 |
|
| 104 |
+
|
| 105 |
+

|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
## Limitations
|
| 109 |
+
|
| 110 |
+
- "Dead" means visible mortality symptoms in RGB (grey or brown crowns, leaf loss, snags), not physiological death.
|
| 111 |
+
Leaf-off deciduous trees, shadows, flowering and pale-crowned species can look dead.
|
| 112 |
+
- The DTE benchmark labels come from the same box-fraction rule as pretraining, which favours this model on that benchmark.
|
| 113 |
+
Partly dead crowns and boxes that include a dead neighbour are labelled noisily.
|
| 114 |
+
- Trained and tested at about 0.1 m resolution. It has not been validated on coarser imagery such as NAIP (0.6 m).
|
| 115 |
+
- The NEON hand-labelled Dead crops are larger than the Alive ones (median 85 vs 53 px), so the model may use crop size as a cue.
|
| 116 |
+
- Field-survey crowns are matched to the nearest detected crown and were checked only for obvious errors, so some boxes may still cover a neighbour.
|
| 117 |
+
|
| 118 |
+
## Data and citation
|
| 119 |
+
|
| 120 |
+
Fine-tuning data: NEON Woody Vegetation Structure (DP1.10098.001, RELEASE-2026) and NEON RGB orthomosaics (DP3.30010.001).
|
| 121 |
+
Pretraining data: deadtrees.earth-aerial, CC BY 4.0. Please cite Sharma et al. (2026) and credit the orthophoto contributors listed in the dataset metadata.
|
| 122 |
+
|
| 123 |
+
```bibtex
|
| 124 |
+
@misc{sharma2026deadtreesearthaerial,
|
| 125 |
+
title={deadtrees.earth-aerial: A Multi-Resolution Aerial Image Dataset for Tree Cover and Mortality Detection},
|
| 126 |
+
author={Sharma, Ayushi and Mosig, Clemens and Drees, Lukas and Soltani, Salim and Vajna-Jehle, Janusch and Sheppard, Aaron and Ahmadi, Belqis and Schmid, Jonathan and Neumeier, Paul and Jacobs, Nathan and Wegner, Jan Dirk and Kattenborn, Teja},
|
| 127 |
+
year={2026}, eprint={2605.19605}, archivePrefix={arXiv}, primaryClass={cs.CV}
|
| 128 |
+
}
|
| 129 |
+
|
| 130 |
+
@article{weinstein2023capturing,
|
| 131 |
+
title={Capturing long-tailed individual tree diversity using an airborne imaging and a multi-temporal hierarchical model},
|
| 132 |
+
author={Weinstein, Ben G and others},
|
| 133 |
+
journal={Remote Sensing in Ecology and Conservation},
|
| 134 |
+
volume={9}, number={5}, pages={656--670}, year={2023}
|
| 135 |
+
}
|
| 136 |
+
```
|
config.json
CHANGED
|
@@ -4,16 +4,22 @@
|
|
| 4 |
"architecture": "retinanet",
|
| 5 |
"batch_size": 1,
|
| 6 |
"cropmodel": {
|
|
|
|
| 7 |
"balance_classes": false,
|
| 8 |
-
"batch_size":
|
|
|
|
| 9 |
"label_dict": {
|
| 10 |
"Alive": 0,
|
| 11 |
"Dead": 1
|
| 12 |
},
|
| 13 |
"lr": 0.0001,
|
| 14 |
-
"
|
| 15 |
-
"num_workers":
|
| 16 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
"scheduler": {
|
| 18 |
"params": {
|
| 19 |
"T_max": 10,
|
|
@@ -37,25 +43,48 @@
|
|
| 37 |
"type": "ReduceLROnPlateau"
|
| 38 |
}
|
| 39 |
},
|
|
|
|
| 40 |
"devices": "auto",
|
| 41 |
-
"label_dict":
|
| 42 |
-
|
| 43 |
-
|
| 44 |
"model": {
|
| 45 |
"name": "weecology/deepforest-tree",
|
| 46 |
"revision": "main"
|
| 47 |
},
|
| 48 |
"nms_thresh": 0.05,
|
| 49 |
-
"num_classes":
|
|
|
|
| 50 |
"patch_overlap": 0.05,
|
| 51 |
"patch_size": 400,
|
| 52 |
"path_to_raster": null,
|
| 53 |
"path_to_rgb": null,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 54 |
"predict": {
|
| 55 |
"pin_memory": false
|
| 56 |
},
|
| 57 |
"rgb_dir": null,
|
| 58 |
"score_thresh": 0.1,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
"train": {
|
| 60 |
"augmentations": [
|
| 61 |
{
|
|
@@ -68,6 +97,15 @@
|
|
| 68 |
"epochs": 1,
|
| 69 |
"fast_dev_run": false,
|
| 70 |
"lr": 0.001,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 71 |
"preload_images": false,
|
| 72 |
"root_dir": null,
|
| 73 |
"scheduler": {
|
|
@@ -91,8 +129,10 @@
|
|
| 91 |
"threshold_mode": "rel"
|
| 92 |
},
|
| 93 |
"type": null
|
| 94 |
-
}
|
|
|
|
| 95 |
},
|
|
|
|
| 96 |
"validation": {
|
| 97 |
"augmentations": [],
|
| 98 |
"csv_file": null,
|
|
@@ -101,7 +141,8 @@
|
|
| 101 |
"preload_images": false,
|
| 102 |
"root_dir": null,
|
| 103 |
"size": null,
|
| 104 |
-
"val_accuracy_interval": 20
|
|
|
|
| 105 |
},
|
| 106 |
"workers": 0
|
| 107 |
}
|
|
|
|
| 4 |
"architecture": "retinanet",
|
| 5 |
"batch_size": 1,
|
| 6 |
"cropmodel": {
|
| 7 |
+
"architecture": "resnet50",
|
| 8 |
"balance_classes": false,
|
| 9 |
+
"batch_size": 128,
|
| 10 |
+
"expand": 0,
|
| 11 |
"label_dict": {
|
| 12 |
"Alive": 0,
|
| 13 |
"Dead": 1
|
| 14 |
},
|
| 15 |
"lr": 0.0001,
|
| 16 |
+
"normalize": null,
|
| 17 |
+
"num_workers": 8,
|
| 18 |
+
"resize": [
|
| 19 |
+
224,
|
| 20 |
+
224
|
| 21 |
+
],
|
| 22 |
+
"resize_interpolation": "bilinear",
|
| 23 |
"scheduler": {
|
| 24 |
"params": {
|
| 25 |
"T_max": 10,
|
|
|
|
| 43 |
"type": "ReduceLROnPlateau"
|
| 44 |
}
|
| 45 |
},
|
| 46 |
+
"detections_per_img": 300,
|
| 47 |
"devices": "auto",
|
| 48 |
+
"label_dict": null,
|
| 49 |
+
"log_root": "./lightning_logs",
|
| 50 |
+
"matmul_precision": "highest",
|
| 51 |
"model": {
|
| 52 |
"name": "weecology/deepforest-tree",
|
| 53 |
"revision": "main"
|
| 54 |
},
|
| 55 |
"nms_thresh": 0.05,
|
| 56 |
+
"num_classes": null,
|
| 57 |
+
"num_nodes": 1,
|
| 58 |
"patch_overlap": 0.05,
|
| 59 |
"patch_size": 400,
|
| 60 |
"path_to_raster": null,
|
| 61 |
"path_to_rgb": null,
|
| 62 |
+
"point": {
|
| 63 |
+
"backbone": "pvt_v2_b3",
|
| 64 |
+
"count_cls_weight": 1.0,
|
| 65 |
+
"density_l1_weight": 0.01,
|
| 66 |
+
"density_sigma": 5.0,
|
| 67 |
+
"distance_threshold": 10.0,
|
| 68 |
+
"enforce_count": true,
|
| 69 |
+
"losses": null,
|
| 70 |
+
"mae_weight": 1.0,
|
| 71 |
+
"nms_distance_thresh": 5.0,
|
| 72 |
+
"norm_cood": false,
|
| 73 |
+
"num_of_iter_in_ot": 100,
|
| 74 |
+
"ot_weight": 0.1,
|
| 75 |
+
"score_integration_radius": 5,
|
| 76 |
+
"sinkhorn_reg": 1.0
|
| 77 |
+
},
|
| 78 |
+
"precision": "32-true",
|
| 79 |
"predict": {
|
| 80 |
"pin_memory": false
|
| 81 |
},
|
| 82 |
"rgb_dir": null,
|
| 83 |
"score_thresh": 0.1,
|
| 84 |
+
"skip_empty": true,
|
| 85 |
+
"strategy": "auto",
|
| 86 |
+
"sync_batchnorm": false,
|
| 87 |
+
"topk_candidates": 1000,
|
| 88 |
"train": {
|
| 89 |
"augmentations": [
|
| 90 |
{
|
|
|
|
| 97 |
"epochs": 1,
|
| 98 |
"fast_dev_run": false,
|
| 99 |
"lr": 0.001,
|
| 100 |
+
"optimizer": {
|
| 101 |
+
"betas": [
|
| 102 |
+
0.9,
|
| 103 |
+
0.999
|
| 104 |
+
],
|
| 105 |
+
"momentum": 0.9,
|
| 106 |
+
"type": "SGD",
|
| 107 |
+
"weight_decay": 0.0
|
| 108 |
+
},
|
| 109 |
"preload_images": false,
|
| 110 |
"root_dir": null,
|
| 111 |
"scheduler": {
|
|
|
|
| 129 |
"threshold_mode": "rel"
|
| 130 |
},
|
| 131 |
"type": null
|
| 132 |
+
},
|
| 133 |
+
"validate_coordinates": true
|
| 134 |
},
|
| 135 |
+
"use_distributed_sampler": true,
|
| 136 |
"validation": {
|
| 137 |
"augmentations": [],
|
| 138 |
"csv_file": null,
|
|
|
|
| 141 |
"preload_images": false,
|
| 142 |
"root_dir": null,
|
| 143 |
"size": null,
|
| 144 |
+
"val_accuracy_interval": 20,
|
| 145 |
+
"validate_coordinates": true
|
| 146 |
},
|
| 147 |
"workers": 0
|
| 148 |
}
|
model.safetensors
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 94291856
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:986a84bf9fb18bb204233f25a148720131f54582896253eca428d6ad84385566
|
| 3 |
size 94291856
|
pr_calibration.png
ADDED
|
Git LFS Details
|