TOFMapper / README.md
Moerizzi's picture
Add model card
233c4be verified
|
Raw History Blame Contribute Delete
4.49 kB
---
license: gpl-3.0
library_name: pytorch
pipeline_tag: image-segmentation
tags:
- semantic-segmentation
- remote-sensing
- aerial-imagery
- trees-outside-forest
- pytorch-lightning
---
# TOFMapper
Trained checkpoints for mapping and classifying **Trees outside Forest (TOF)** in high-resolution aerial RGB orthophotos, from the paper
[Mapping and classification of trees outside forests using deep learning](https://doi.org/10.1016/j.srs.2026.100510)
(Science of Remote Sensing, 2026; preprint: [arXiv:2510.25239](https://arxiv.org/abs/2510.25239)).
- **Code:** https://github.com/Moerizzy/TOFMapper
- **Training data:** https://zenodo.org/records/17468859
## Models
| Model | File | Config | Size |
|---|---|---|---|
| FT-UNetFormer | `ftunetformer.ckpt` | [`config/tof/ftunetformer.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/ftunetformer.py) | 1.5 GB |
| DC-Swin | `dcswin.ckpt` | [`config/tof/dcswin_small.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/dcswin_small.py) | 1.1 GB |
| ABCNet | `abcnet.ckpt` | [`config/tof/abcnet.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/abcnet.py) | 216 MB |
| 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 |
| BANet | `banet.ckpt` | [`config/tof/banet.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/banet.py) | 204 MB |
| U-Net | `unet.ckpt` | [`config/tof/unet.py`](https://github.com/Moerizzy/TOFMapper/blob/main/config/tof/unet.py) | 496 MB |
## Classes
| Index | Class |
|---|---|
| 0 | Background |
| 1 | Forest |
| 2 | Patch |
| 3 | Linear |
| 4 | Tree |
## Results
Test-set results as reported in the TOFMapper repository. Best value per column in bold.
| Model | mIoU | mF1 | Forest IoU | Forest F1 | Patch IoU | Patch F1 | Linear IoU | Linear F1 | Tree IoU | Tree F1 |
|---|---|---|---|---|---|---|---|---|---|---|
| ABCNet | 0.709 | 0.821 | 0.944 | 0.971 | 0.532 | 0.695 | 0.739 | 0.850 | 0.622 | 0.767 |
| BANet | 0.656 | 0.777 | 0.937 | 0.967 | 0.422 | 0.593 | 0.689 | 0.816 | 0.575 | 0.730 |
| DC-Swin | 0.714 | 0.824 | 0.949 | 0.974 | 0.570 | 0.726 | 0.751 | 0.858 | 0.586 | 0.727 |
| FT-UNetFormer | **0.739** | **0.843** | **0.952** | **0.975** | **0.606** | **0.754** | **0.774** | **0.872** | **0.626** | **0.770** |
| LSKNet | 0.697 | 0.812 | 0.943 | 0.971 | 0.545 | 0.705 | 0.718 | 0.836 | 0.582 | 0.736 |
| U-Net | 0.484 | 0.618 | 0.804 | 0.891 | 0.151 | 0.263 | 0.527 | 0.690 | 0.456 | 0.626 |
## Usage
The files are PyTorch Lightning checkpoints and are loaded through the TOFMapper code, not through `transformers`.
Set up the repository as described in its README, then download a checkpoint to the location its config expects
(run from the `Project` folder that contains `TOFMapper/`). Example for FT-UNetFormer:
```python
from huggingface_hub import hf_hub_download
name = "ftunetformer" # or: dcswin, abcnet, unetformer_lsk_s, banet, unet
hf_hub_download(
repo_id="Moerizzi/TOFMapper",
filename=f"{name}.ckpt",
local_dir=f"model_weights/tof/{name}",
)
```
Run inference on a folder of georeferenced RGB orthophotos with the matching config:
```bash
python TOFMapper/inference_with_overlap.py \
-i path/to/images \
-c TOFMapper/config/tof/ftunetformer.py \
-o path/to/output \
-st 256 -ps 1024 -b 2 -m 500 -kr 0.7
```
Predictions are written as GeoTIFF and converted to a shapefile.
> **Use an up-to-date checkout of the code.** Versions of `inference_with_overlap.py` before 9 October 2026
> swapped the red and blue channels at inference, which does not match how the models were trained.
## Input
3-band RGB orthophotos (8 bit), normalised with ImageNet mean and standard deviation. The models were trained on 1024 x 1024 px patches.
## License
GPL-3.0, the same as the TOFMapper code.
## Citation
```bibtex
@article{LUCAS2026100510,
title = {Mapping and classification of trees outside forests using deep learning},
journal = {Science of Remote Sensing},
volume = {14},
pages = {100510},
year = {2026},
issn = {2666-0172},
doi = {https://doi.org/10.1016/j.srs.2026.100510},
url = {https://www.sciencedirect.com/science/article/pii/S2666017226001483},
author = {Moritz Lucas and Hamid Ebrahimy and Viacheslav Barkov and Ralf Pecenka and Kai-Uwe Kühnberger and Björn Waske}
}
```
## Acknowledgement
TOFMapper builds on [GeoSeg](https://github.com/WangLibo1995/GeoSeg) by Libo Wang.