floorplan-dfine-str / README.md
ji-song's picture
Card: per-dataset credits and citations
e117e4d verified
|
Raw History Blame Contribute Delete
11 kB
---
license: apache-2.0
library_name: pytorch
pipeline_tag: object-detection
tags:
- object-detection
- floor-plan
- architecture
- d-fine
- document-analysis
- swiss-dwellings
- synbuild-3d
# Training data (no HF dataset ids): AI-Hub 71465 (Korea, not redistributed),
# Swiss Dwellings v3.0.0 (Zenodo 10.5281/zenodo.7788422, CC BY 4.0), SYNBUILD-3D (Stanford Digital Repository PURL kz908vb7844, arXiv:2508.21169, CC BY 4.0),
# Floorplan Synthetic 2500 (figshare 28282802, CC BY 4.0).
---
# floorplan-dfine-str — floor-plan structure detector (D-FINE-M)
Object detector for architectural floor-plan drawings, **STR — structure layer**. It is one of three
sibling models that share one class taxonomy (`config.json -> id2label`), so their outputs can be merged
into a single page parse: [digitalpresso/floorplan-dfine-obj](https://huggingface.co/digitalpresso/floorplan-dfine-obj), [digitalpresso/floorplan-dfine-spa](https://huggingface.co/digitalpresso/floorplan-dfine-spa).
- Architecture: D-FINE-M (HGNetv2-B2), 19.9 M parameters, 256 queries, 80 MB (safetensors)
- Input: 1920 x 1920 tiles of full-resolution drawings (25 % overlap), see *How to use*
- Initialization: official **COCO-only** D-FINE-M checkpoint (no Objects365 lineage)
- Weights: training seed 0 (g3scan s0 (ep6g3scan)); metrics below also give the 3-seed spread
## Classes
| id | name |
|---|---|
| 1 | wall |
| 2 | door |
| 3 | window |
| 4 | railing |
Ids follow the shared taxonomy (id = taxonomy index + 1), which is why this model's ids do not start at 1.
## How to use
Drawings are large and symbols are small, so inference must reproduce the training protocol:
**1920 px tiles with 25 % overlap**, per-tile detection, then per-class NMS across tiles.
`inference/infer.py` does this. It needs the *unmodified* upstream D-FINE source (Apache-2.0) pinned to
commit `956d170`; the released weights load into it with `strict=True`.
```bash
git clone https://huggingface.co/digitalpresso/floorplan-dfine-str && cd floorplan-dfine-str
git clone https://github.com/Peterande/D-FINE && git -C D-FINE checkout 956d170
pip install -r inference/requirements.txt
python inference/infer.py --dfine-root D-FINE --image examples/example_01.png \
--out detections.json --viz detections_viz.png
```
Output: JSON list of `{"label", "category_id", "bbox": [x, y, w, h], "score"}` in page pixels.
Defaults (score > 0.3, NMS IoU 0.6) are in `config.json`. `--drop-truncated` additionally
removes cut-off fragments at interior tile edges; it is off by default because the metrics below were measured without it.
Add `--device cpu` (or `cuda:0`) to choose the device; a 2048 px page takes a few seconds on CPU.
## Evaluation
Mean ± standard deviation over **3 training seeds**; this repository contains seed 0 (last column).
| Benchmark | Metric | 3 seeds, mean ± sd | **This release (seed 0)** |
|---|---|---|---|
| Korean held-out test (1,453 drawings, AI-Hub 71465 derived) | mAP@0.5 | 0.952 ± 0.000 | 0.952 |
| Swiss Dwellings val | mAP@0.5 | 0.889 ± 0.001 | 0.890 |
| Swiss Dwellings val | mAP@0.5:0.95 | 0.761 ± 0.001 | 0.761 |
| SYNBUILD-3D val | mAP@0.5 | 0.989 ± 0.000 | 0.989 |
| SYNBUILD-3D val | mAP@0.5:0.95 | 0.970 ± 0.013 | 0.968 |
| Floorplan Synthetic 2500 val | mAP@0.5 | 0.993 ± 0.000 | 0.993 |
| Floorplan Synthetic 2500 val | mAP@0.5:0.95 | 0.991 ± 0.000 | 0.991 |
- Korean held-out test: a frozen, de-duplicated test set built from AI-Hub dataset 71465, never used for training or
model selection. Classes that belong to another layer and appear only by accident in this task's ground truth are excluded
from the average (a single such box would otherwise move the macro average by more than 0.1).
- Swiss / SYNBUILD: validation splits of our rasterized versions, split by site (Swiss) or by building (SYNBUILD),
so no building appears in both train and validation.
Per-class AP@0.5, seed 0, Swiss Dwellings val:
| Class | AP@0.5 | GT boxes |
|---|---|---|
| wall | 0.813 | 166,331 |
| door | 0.928 | 50,358 |
| window | 0.987 | 23,249 |
| railing | 0.831 | 16,071 |
SYNBUILD-3D val, seed 0: wall 0.988, door 0.990, window 0.990.
Per-class AP@0.5, seed 0, Korean held-out test:
| Class | AP@0.5 |
|---|---|
| wall | 0.928 |
| window | 0.969 |
| door | 0.960 |
## Limitations
- **Wall convention.** All sources use one wall convention: a wall is a straight segment between openings
(the AI-Hub convention). Swiss walls were re-derived from the vector geometry to match, so the Swiss val numbers
here are measured against segment-style ground truth. Non-orthogonal walls are boxed axis-aligned (loose boxes).
- Swiss wall AP (0.81) is lower than door/window: wall segments are thin and densely packed.
- **Railing** is annotated only in Swiss Dwellings; railing AP on Swiss val is 0.83, lower than in the previous
internal version that used blob-style walls (0.89) — thin wall segments and railings look alike.
- SYNBUILD-3D and Floorplan Synthetic 2500 are synthetic and near saturated (mAP@0.5 about 0.99), so they say little
about real drawings; on SYNBUILD the stricter mAP@0.5:0.95 is lower (0.970).
- The model detects wall *segments* as boxes, not centre lines or polygons.
- **Drawing conventions.** Trained on Korean apartment plans (AI-Hub), Swiss apartments and synthetic
buildings. Plans with very different drafting conventions (hatching styles, CAD colour schemes,
hand-drawn sketches) are out of distribution.
- **Scale.** In the training data a door is roughly 60-70 px long. Rasters at a much lower resolution should
be upscaled to about that scale before inference.
- **Scan quality.** Trained with a scan / re-print degradation augmentation (applied to half of the training
tiles: resolution loss, blur, paper and ink level shifts, noise, JPEG artefacts). Strongly degraded scans,
especially downscaled ones, still increase missed and spurious boxes.
- Detection only: no room polygons, no text/OCR, no dimension reading.
## Training data
| Source | License | Training tiles |
|---|---|---|
| AI-Hub 건축 도면 데이터 (71465), NIA, Korea | AI-Hub terms (model release permitted with attribution; data not redistributed) | 225,402 |
| Swiss Dwellings v3.0.0 (Zenodo 10.5281/zenodo.7788422, Archilyse AG), rasterized by us; walls re-derived as straight segments | CC BY 4.0 | 18,063 |
| SYNBUILD-3D (Stanford Digital Repository PURL kz908vb7844, arXiv:2508.21169), rasterized by us | CC BY 4.0 | 38,737 |
| Floorplan Synthetic 2500 (figshare 28282802), labels derived by us from the colour-coded renders | CC BY 4.0 | 4,622 (2,311 x 2) |
AI-Hub, SYNBUILD-3D and Floorplan Synthetic 2500 have no railing labels; the classification loss is masked for classes a source does not annotate, so they are not learned as background.
Training: 6 epochs, AdamW, batch 8, strong augmentation for the first 2 epochs, scan / re-print degradation
augmentation on half of the tiles, 1920 px tiles.
### Datasets and acknowledgements
- 건축 도면 데이터 (Architectural Drawing Data), [AI-Hub dataset #71465](https://www.aihub.or.kr/aihubdata/data/view.do?dataSetSn=71465), NIA, Korea. AI-Hub terms of use.
- [Swiss Dwellings v3.0.0](https://doi.org/10.5281/zenodo.7788422), Standfest et al., Archilyse AG. [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
- [SYNBUILD-3D](https://doi.org/10.25740/kz908vb7844), Mayer, Vesel, Zhao, Fischer. [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
- [Floorplan Synthetic 2500](https://doi.org/10.6084/m9.figshare.28282802), Rodrigues and Parente. [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
This research used datasets from 'The Open AI Dataset Project (AI-Hub, S. Korea)'.
All data information can be accessed through 'AI-Hub (www.aihub.or.kr)'.
> 이 연구는 과학기술정보통신부의 재원으로 한국지능정보사회진흥원의 지원을 받아 구축된 "건축 도면 데이터"를
> 활용하여 수행된 연구입니다. 본 연구에 활용된 데이터는 AI 허브(aihub.or.kr)에서 다운로드할 수 있습니다.
No AI-Hub data is redistributed here. The datasets keep their own licenses; the Apache-2.0 license of this
repository does not relicense them. The dataset creators do not endorse this work.
If you use these models, please also cite the work they are built on:
```bibtex
@misc{peng2024dfine,
title = {D-FINE: Redefine Regression Task in DETRs as Fine-grained Distribution Refinement},
author = {Yansong Peng and Hebei Li and Peixi Wu and Yueyi Zhang and Xiaoyan Sun and Feng Wu},
year = {2024},
eprint = {2410.13842},
archivePrefix = {arXiv},
primaryClass = {cs.CV}
}
@dataset{standfest_swiss_dwellings_v3,
author = {Standfest, Matthias and Franzen, Michael and Schröder, Yvonne and Gonzalez Medina, Luis and Villanueva Hernandez, Yarilo and Buck, Jan Hendrik and Tan, Yen-Ling and Niedzwiecka, Milena and Colmegna, Rachele},
title = {Swiss Dwellings: A large dataset of apartment models including aggregated geolocation-based simulation results covering viewshed, natural light, traffic noise, centrality and geometric analysis},
publisher = {Zenodo},
version = {3.0.0},
year = {2023},
doi = {10.5281/zenodo.7788422}
}
@dataset{synbuild3d,
title = {SYNBUILD-3D: A large, multi-modal, and semantically rich synthetic dataset of 3D building models at Level of Detail 4},
author = {Mayer, Kevin and Vesel, Alex and Zhao, Xinyi and Fischer, Martin},
year = {2025},
publisher = {Stanford Research Data},
doi = {10.25740/kz908vb7844},
url = {https://purl.stanford.edu/kz908vb7844}
}
@dataset{rodrigues_parente_2025_floorplans,
author = {Rodrigues, Eugénio and Parente, Jean Marcell},
title = {Dataset of 2500 synthetic single-family floor plan images ranging from T0 to T4},
publisher = {figshare},
year = {2025},
doi = {10.6084/m9.figshare.28282802}
}
```
Training tiles are 1920 px crops (Swiss: 2048 px mosaics of floor plans).
## Examples
`examples/example_01.png`, `example_02.png`: 2048 px mosaics of validation floor plans from Swiss Dwellings
(CC BY 4.0, Archilyse AG), rasterized by us from the published vector geometry. `example_01_pred.png` is this model's output on example_01.
## License and attribution
Code (training, data conversion, evaluation, benchmarks): <https://github.com/Digitalpresso-ai/floorplan-global>
Weights and code: **Apache License 2.0** (see `LICENSE`, `NOTICE`). Copyright 2026 digitalpresso
Third-party attributions (D-FINE and the datasets above) are listed in `NOTICE`.
## Citation
```bibtex
@misc{floorplan_dfine_str_2026,
title = {floorplan-dfine-str: D-FINE floor-plan structure detector},
author = {digitalpresso},
year = {2026},
howpublished = {Hugging Face model repository},
url = {https://huggingface.co/digitalpresso/floorplan-dfine-str}
}
```