File size: 1,746 Bytes
81b4960
3916f66
 
 
 
 
 
70f27ca
3916f66
 
81b4960
70f27ca
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
pipeline_tag: image-segmentation
tags:
- image-segmentation
- historical-maps
- cartography
- vectorization
library_name: pytorch
---


# Building Block Vectorization in Historical Maps

Polygon extraction of building blocks from historical maps of Paris. 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

Single-class binary segmentation of building blocks ("block"). Each subfolder contains one `model_f{N}.safetensors` per cross-validation fold plus a shared `config.json` carrying model configuration, class names, per-fold and ensemble decision thresholds, normalization mode, recommended sliding-window patch size (512), and number of folds.

| Subfolder | Architecture | Encoder | Folds |
|---|---|---|---|
| `unet_scse` | U-Net + SCSE attention | EfficientNet-B3 | 2 |

## Usage

```bash
pip install torch segmentation-models-pytorch safetensors huggingface_hub pillow numpy

python inference.py \
  --hf-repo davidclara/building-block-vectorization \
  --model-name unet_scse \
  --image map.jpg \
  --out mask.png
```

`inference.py` is a minimal example: Gaussian-weighted sliding-window prediction with `stride = patch_size // 2`, normalization driven by `config.json` (`simple` = `/255`, `imagenet` = mean/std), sigmoid averaged across folds per patch, thresholding with the ensemble threshold, and writing a single binary PNG mask. For the full training and inference pipeline see the [GitHub repository](https://github.com/dav1dclara/cartography-research).