Downloads · 30 days
0
dnovak232/kastela-dof5-building-segmentation
kastela-dof5-building-segmentation is a image segmentation model from dnovak232. Use it for the image segmentation task on the model card, and read the license before you ship it in a product. It is set up for pytorch. The card lists the license as cc-by-4.0.
Binary building-footprint segmentation model for Croatian official digital orthophotos (DOF5) published by the State Geodetic Administration (Državna geodetska uprava, DGU). Given a 3-band RGB orthophoto chip at ~0.5…
Downloads · 30 days
0
Access
Public
Updated Jul 19, 2026
Repo size
97.9 MB
Likes
0
Public
Click a slice to open those files.
.pt97.9 MB · 100%
From the Hugging Face model README
Binary building-footprint segmentation model for Croatian official digital orthophotos (DOF5) published by the State Geodetic Administration (Državna geodetska uprava, DGU). Given a 3-band RGB orthophoto chip at ~0.5 m/pixel, it predicts a per-pixel probability of "building". Developed for a longitudinal construction-monitoring study of the City of Kaštela (Split-Dalmatia County), 2011–2023.
unet_best.pt (PyTorch state_dict, ~98 MB)Imagery — DGU DOF5 digital orthophoto, 2023 survey. The official
state orthophoto map of the Republic of Croatia at 1:5000 scale, RGB,
native 20–25 cm GSD, served openly via the DGU Geoportal WMS
(https://geoportal.dgu.hr/services/inspire/orthophoto_2023/wms,
"Digitalni ortofoto 2023. – WMS za anonimne korisnike"). Downloaded and
resampled to 0.5 m/px over the study area (City of Kaštela and
surroundings, ~215 km², HTRS96/TM EPSG:3765). Terms: Croatian Open Data
Licence (https://data.gov.hr/otvorena-dozvola), attribution: Državna
geodetska uprava, Republika Hrvatska.
Labels — DGU cadastral building polygons (INSPIRE Buildings theme).
"Zgrade iz Digitalnog katastarskog plana – INSPIRE" served via public WFS
(https://api.uredjenazemlja.hr/services/inspire/bu/wfs, layer
BU.Building). ~38,000 building polygons within the study area were
rasterized over the 2023 mosaic as binary masks. Attribution: Državna
geodetska uprava / Uređena zemlja.
Dataset: ~1,900 chips of 512×512 px (0.5 m GSD), all chips containing buildings plus 25% of building-free chips (hard negatives: orchards, vineyards, bare karst, roads, greenhouses). 85/15 train/validation split.
Label noise is inherent and accepted: unregistered buildings appear as unlabeled roofs; a small number of registered buildings post-date the 2023 imagery. The model demonstrably still learns to detect unregistered buildings, since they are visually identical to registered ones.
BCE + Dice loss, AdamW (lr 3e-4, cosine annealing), batch 16, mixed precision, early stopping on validation IoU. Augmentation: flips, 90° rotations, and photometric augmentation designed for epoch transfer (per-channel gamma 0.6–1.6, Gaussian blur σ 0.5–1.8, sensor noise) so the model generalizes from the 2023 survey to older, hazier DOF5 epochs (2011, 2014/16, 2017, 2019, 2021) despite different cameras and atmospheric conditions. Per-chip z-score input normalization additionally removes linear radiometric differences between epochs.
Pixel validation IoU on held-out 2023 chips: 0.526 (40 epochs, early stopping; best at epoch 30). Note that this is measured against noisy cadastre labels, so instance-level performance is materially better than the pixel score suggests. An ablation without photometric augmentation scores nominally higher on same-epoch validation (0.541) but transfers far worse to older DOF5 epochs (e.g. 25.5% vs 61.5% cadastre coverage on the 2017 epoch) — the augmented model is the published one.
Cross-epoch recall proxy — share of cadastre buildings (≥25 m²) covered
30% by predicted footprints, City of Kaštela (note: the cadastre is cumulative-to-2026, so early epochs are expected to cover less of it — buildings did not exist yet):
| DOF5 epoch | coverage >30% | median coverage |
|---|---|---|
| 2011 | 48.7% | 0.27 |
| 2017 | 61.5% | 0.60 |
| 2019 | 57.6% | 0.52 |
| 2021 | 69.6% | 0.72 |
| 2023 | 80.5% | 0.87 |
import numpy as np, torch, segmentation_models_pytorch as smp
model = smp.Unet("resnet34", encoder_weights=None, in_channels=3, classes=1)
model.load_state_dict(torch.load("unet_best.pt", map_location="cpu"))
model.eval()
def zscore(img): # img: float32 (3,H,W)
m = img.mean(axis=(1, 2), keepdims=True)
s = img.std(axis=(1, 2), keepdims=True) + 1e-6
return (img - m) / s
chip = ... # (3,512,512) uint8 RGB from a DOF5 orthophoto at 0.5 m/px
x = torch.from_numpy(zscore(chip.astype(np.float32))[None])
with torch.no_grad():
prob = torch.sigmoid(model(x))[0, 0].numpy() # (512,512) in [0,1]
mask = prob > 0.5
inference_example.py in this repository is a complete sliding-window
script: GeoTIFF/VRT in → building-footprint GeoPackage out.
Model weights and card: CC-BY-4.0. The model derives from open data of the Republic of Croatia; when using it or its outputs, attribute:
Imagery and cadastral data: Državna geodetska uprava (DGU), Republika Hrvatska — DOF5 digital orthophoto (geoportal.dgu.hr) and INSPIRE Buildings / Digitalni katastarski plan (uredjenazemlja.hr), Croatian Open Data Licence (data.gov.hr/otvorena-dozvola).