| --- |
| 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). |
|
|
|
|