File size: 1,788 Bytes
c3a9a88
 
44dde00
 
 
 
 
40bf61a
cee0381
 
 
 
acde23d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6b479bf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---
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).