| --- |
| license: apache-2.0 |
| pipeline_tag: image-segmentation |
| tags: |
| - image-segmentation |
| - historical-maps |
| - cartography |
| library_name: pytorch |
| --- |
| |
| # Semantic Segmentation in Historical Maps |
|
|
| Pixel-level land cover classification of historical maps from the Swiss Siegfried map series. Trained as part of the course [Research Topics in Cartography](https://karto.ethz.ch/en/education/courses/master/research-topics-cartography.html) at ETH Zurich (Spring 2026). Source code: [github.com/dav1dclara/cartography-research](https://github.com/dav1dclara/cartography-research). |
|
|
| ## Models |
|
|
| Seven classes, multi-label (a pixel can belong to multiple classes): **River, Forest, Lake, Wetland, Stream, Building, Road**. Each subfolder contains a `model.safetensors` plus a `config.json` carrying model configuration, class names, per-class decision thresholds, and recommended sliding-window patch size (512). |
|
|
| | Subfolder | Architecture | Encoder | |
| |---|---|---| |
| | `unet` | U-Net | EfficientNet-B4 | |
| | `unet_scse` | U-Net + SCSE attention | EfficientNet-B4 | |
| | `unetpp` | U-Net++ | EfficientNet-B4 | |
| | `deeplabv3p` | DeepLabV3+ | EfficientNet-B4 | |
| | `fpn` | FPN | EfficientNet-B4 | |
| | `pan` | PAN | EfficientNet-B4 | |
|
|
| ## Usage |
|
|
| ```bash |
| pip install torch segmentation-models-pytorch safetensors huggingface_hub pillow numpy |
| |
| python inference.py \ |
| --hf-repo davidclara/siegfried-maps-segmentation \ |
| --model-name unetpp \ |
| --image map.png \ |
| --out-dir predictions/ |
| ``` |
|
|
| `inference.py` is a minimal example: sliding-window prediction with `stride = patch_size // 2`, ImageNet normalization, sigmoid + per-class thresholding, writing one binary PNG per class to `--out-dir`. For the full training and inference pipeline see the [GitHub repository](https://github.com/dav1dclara/cartography-research). |