| --- |
| license: mit |
| library_name: deepforest |
| pipeline_tag: image-classification |
| tags: |
| - deepforest |
| - crop-model |
| - tree-genus |
| - ecology |
| - neon |
| --- |
| |
| # Tree Genus Classification (CropModel) |
|
|
| Classifies tree crowns detected by [DeepForest](https://github.com/weecology/DeepForest) into 54 genera. Trained on RGB imagery from 29 [NEON](https://www.neonscience.org/) sites across North America. |
|
|
| Trained with [NeonTreeClassification](https://github.com/GatorSense/NeonTreeClassification). |
|
|
| ## Usage |
|
|
| ```python |
| from deepforest import main |
| from deepforest.model import CropModel |
| |
| detector = main.deepforest() |
| detector.load_model("weecology/deepforest-tree") |
| |
| genus_model = CropModel.load_model("weecology/cropmodel-tree-genus") |
| |
| results = detector.predict_tile(path="tile.tif", crop_model=genus_model) |
| # results has columns: cropmodel_label, cropmodel_score |
| ``` |
|
|
| ## Results (Test Set) |
|
|
| | Metric | Value | |
| |---|---| |
| | Accuracy | 44.0% | |
| | Macro F1 | 0.25 | |
| | Weighted F1 | 0.44 | |
| | Classes | 54 | |
|
|
| Full per-class precision/recall/F1 in [`classification_report.csv`](classification_report.csv). |
|
|
| ## Training |
|
|
| | Parameter | Value | |
| |---|---| |
| | Architecture | ResNet-18 (torchvision, ImageNet pretrained) | |
| | Input | 224x224 RGB, ImageNet normalization | |
| | Resize interpolation | nearest-neighbor | |
| | Optimizer | AdamW (lr=2.5e-4, weight_decay=1e-4) | |
| | Scheduler | ReduceLROnPlateau | |
| | Max epochs | 500 (early stopping patience=15) | |
| | Best epoch | 3 (val_loss=2.22) | |
| | Batch size | 256 | |
| | Class weights | sqrt inverse-frequency | |
| | Seed | 42 | |
|
|
| ## Dataset |
|
|
| 16,348 deduplicated tree crowns from 29 NEON sites. One sample per unique individual, rare species (<6 samples) removed. Labels from NEON Vegetation Structure Taxonomy (VST) field surveys. RGB crown crops extracted at 0.1m resolution. |
|
|
| | Split | Samples | |
| |---|---| |
| | Train (70%) | 11,443 | |
| | Val (15%) | 2,452 | |
| | Test (15%) | 2,453 | |
|
|
| Split method: stratified random, seed=42. |
|
|
| **Sites**: ABBY, BART, BONA, CLBJ, DEJU, DELA, GRSM, GUAN, HARV, HEAL, JERC, KONZ, LENO, MLBS, MOAB, NIWO, ONAQ, OSBS, PUUM, RMNP, SCBI, SERC, SJER, SOAP, TALL, TEAK, UKFS, UNDE, WREF |
|
|
| ## License |
|
|
| MIT |
|
|