Add model card
Browse files
README.md
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: gpl-3.0
|
| 3 |
+
library_name: pytorch
|
| 4 |
+
pipeline_tag: image-segmentation
|
| 5 |
+
tags:
|
| 6 |
+
- semantic-segmentation
|
| 7 |
+
- remote-sensing
|
| 8 |
+
- aerial-imagery
|
| 9 |
+
- trees-outside-forest
|
| 10 |
+
- pytorch-lightning
|
| 11 |
+
---
|
| 12 |
+
|
| 13 |
+
# TOFMapper
|
| 14 |
+
|
| 15 |
+
Trained checkpoints for mapping and classifying **Trees outside Forest (TOF)** in high-resolution aerial RGB orthophotos, from the paper
|
| 16 |
+
[Mapping and classification of trees outside forests using deep learning](https://doi.org/10.1016/j.srs.2026.100510)
|
| 17 |
+
(Science of Remote Sensing, 2026; preprint: [arXiv:2510.25239](https://arxiv.org/abs/2510.25239)).
|
| 18 |
+
|
| 19 |
+
- **Code:** https://github.com/Moerizzy/TOFMapper
|
| 20 |
+
- **Training data:** https://zenodo.org/records/17468859
|
| 21 |
+
|
| 22 |
+
## Models
|
| 23 |
+
|
| 24 |
+
| Model | File | Config | Size |
|
| 25 |
+
|---|---|---|---|
|
| 26 |
+
| FT-UNetFormer | `ftunetformer.ckpt` | [`config/tof/ftunetformer.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/ftunetformer.py) | 1.5 GB |
|
| 27 |
+
| DC-Swin | `dcswin.ckpt` | [`config/tof/dcswin_small.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/dcswin_small.py) | 1.1 GB |
|
| 28 |
+
| ABCNet | `abcnet.ckpt` | [`config/tof/abcnet.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/abcnet.py) | 216 MB |
|
| 29 |
+
| LSKNet | `unetformer_lsk_s.ckpt` | [`config/tof/unetformer_lsk_s.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/unetformer_lsk_s.py) | 231 MB |
|
| 30 |
+
| BANet | `banet.ckpt` | [`config/tof/banet.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/banet.py) | 204 MB |
|
| 31 |
+
| U-Net | `unet.ckpt` | [`config/tof/unet.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/unet.py) | 496 MB |
|
| 32 |
+
|
| 33 |
+
## Classes
|
| 34 |
+
|
| 35 |
+
| Index | Class |
|
| 36 |
+
|---|---|
|
| 37 |
+
| 0 | Background |
|
| 38 |
+
| 1 | Forest |
|
| 39 |
+
| 2 | Patch |
|
| 40 |
+
| 3 | Linear |
|
| 41 |
+
| 4 | Tree |
|
| 42 |
+
|
| 43 |
+
## Results
|
| 44 |
+
|
| 45 |
+
Test-set results as reported in the TOFMapper repository. Best value per column in bold.
|
| 46 |
+
|
| 47 |
+
| Model | mIoU | mF1 | Forest IoU | Forest F1 | Patch IoU | Patch F1 | Linear IoU | Linear F1 | Tree IoU | Tree F1 |
|
| 48 |
+
|---|---|---|---|---|---|---|---|---|---|---|
|
| 49 |
+
| ABCNet | 0.709 | 0.821 | 0.944 | 0.971 | 0.532 | 0.695 | 0.739 | 0.850 | 0.622 | 0.767 |
|
| 50 |
+
| BANet | 0.656 | 0.777 | 0.937 | 0.967 | 0.422 | 0.593 | 0.689 | 0.816 | 0.575 | 0.730 |
|
| 51 |
+
| DC-Swin | 0.714 | 0.824 | 0.949 | 0.974 | 0.570 | 0.726 | 0.751 | 0.858 | 0.586 | 0.727 |
|
| 52 |
+
| FT-UNetFormer | **0.739** | **0.843** | **0.952** | **0.975** | **0.606** | **0.754** | **0.774** | **0.872** | **0.626** | **0.770** |
|
| 53 |
+
| LSKNet | 0.697 | 0.812 | 0.943 | 0.971 | 0.545 | 0.705 | 0.718 | 0.836 | 0.582 | 0.736 |
|
| 54 |
+
| U-Net | 0.484 | 0.618 | 0.804 | 0.891 | 0.151 | 0.263 | 0.527 | 0.690 | 0.456 | 0.626 |
|
| 55 |
+
|
| 56 |
+
## Usage
|
| 57 |
+
|
| 58 |
+
The files are PyTorch Lightning checkpoints and are loaded through the TOFMapper code, not through `transformers`.
|
| 59 |
+
Set up the repository as described in its README, then download a checkpoint to the location its config expects
|
| 60 |
+
(run from the `Project` folder that contains `TOFMapper/`). Example for FT-UNetFormer:
|
| 61 |
+
|
| 62 |
+
```python
|
| 63 |
+
from huggingface_hub import hf_hub_download
|
| 64 |
+
|
| 65 |
+
name = "ftunetformer" # or: dcswin, abcnet, unetformer_lsk_s, banet, unet
|
| 66 |
+
hf_hub_download(
|
| 67 |
+
repo_id="Moerizzi/TOFMapper",
|
| 68 |
+
filename=f"{name}.ckpt",
|
| 69 |
+
local_dir=f"model_weights/tof/{name}",
|
| 70 |
+
)
|
| 71 |
+
```
|
| 72 |
+
|
| 73 |
+
Run inference on a folder of georeferenced RGB orthophotos with the matching config:
|
| 74 |
+
|
| 75 |
+
```bash
|
| 76 |
+
python TOFMapper/inference_with_overlap.py \
|
| 77 |
+
-i path/to/images \
|
| 78 |
+
-c TOFMapper/config/tof/ftunetformer.py \
|
| 79 |
+
-o path/to/output \
|
| 80 |
+
-st 256 -ps 1024 -b 2 -m 500 -kr 0.7
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
Predictions are written as GeoTIFF and converted to a shapefile.
|
| 84 |
+
|
| 85 |
+
> **Use an up-to-date checkout of the code.** Versions of `inference_with_overlap.py` before 9 October 2026
|
| 86 |
+
> swapped the red and blue channels at inference, which does not match how the models were trained.
|
| 87 |
+
|
| 88 |
+
## Input
|
| 89 |
+
|
| 90 |
+
3-band RGB orthophotos (8 bit), normalised with ImageNet mean and standard deviation. The models were trained on 1024 x 1024 px patches.
|
| 91 |
+
|
| 92 |
+
## License
|
| 93 |
+
|
| 94 |
+
GPL-3.0, the same as the TOFMapper code.
|
| 95 |
+
|
| 96 |
+
## Citation
|
| 97 |
+
|
| 98 |
+
```bibtex
|
| 99 |
+
@article{LUCAS2026100510,
|
| 100 |
+
title = {Mapping and classification of trees outside forests using deep learning},
|
| 101 |
+
journal = {Science of Remote Sensing},
|
| 102 |
+
volume = {14},
|
| 103 |
+
pages = {100510},
|
| 104 |
+
year = {2026},
|
| 105 |
+
issn = {2666-0172},
|
| 106 |
+
doi = {https://doi.org/10.1016/j.srs.2026.100510},
|
| 107 |
+
url = {https://www.sciencedirect.com/science/article/pii/S2666017226001483},
|
| 108 |
+
author = {Moritz Lucas and Hamid Ebrahimy and Viacheslav Barkov and Ralf Pecenka and Kai-Uwe Kühnberger and Björn Waske}
|
| 109 |
+
}
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
## Acknowledgement
|
| 113 |
+
|
| 114 |
+
TOFMapper builds on [GeoSeg](https://github.com/WangLibo1995/GeoSeg) by Libo Wang.
|