--- license: apache-2.0 library_name: pytorch pipeline_tag: object-detection tags: - object-detection - floor-plan - architecture - d-fine - document-analysis - swiss-dwellings # 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). --- # floorplan-dfine-spa — floor-plan spaces / rooms detector (D-FINE-M) Object detector for architectural floor-plan drawings, **SPA — spaces / rooms 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-str](https://huggingface.co/digitalpresso/floorplan-dfine-str). - Architecture: D-FINE-M (HGNetv2-B2), 19.9 M parameters, 128 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 (g1scan s0 (ep6g1scan)); metrics below also give the 3-seed spread ## Classes | id | name | |---|---| | 5 | living | | 6 | bedroom | | 7 | kitchen | | 8 | bathroom | | 9 | balcony | | 10 | entry | | 11 | closet | | 12 | corridor | | 13 | dining | | 14 | utility | | 15 | storage | | 16 | multipurpose | | 17 | outdoor_unit | | 18 | stairs | | 19 | elevator | | 20 | elevator_hall | | 21 | outdoor | | 22 | room_generic | 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-spa && cd floorplan-dfine-spa 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,204 drawings, AI-Hub 71465 derived) | mAP@0.5 | 0.954 ± 0.004 | 0.958 | | Swiss Dwellings val | mAP@0.5 (macro over classes) | 0.498 ± 0.005 | 0.504 | | Swiss Dwellings val | mAP@0.5:0.95 | 0.465 ± 0.005 | 0.471 | | Swiss Dwellings val | mAP@0.5, ground-truth-weighted | 0.848 ± 0.005 | 0.850 | - 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 | |---|---|---| | living | 0.753 | 2,864 | | bedroom | 0.386 | 2,187 | | kitchen | 0.948 | 4,356 | | bathroom | 0.987 | 6,413 | | balcony | 0.969 | 4,581 | | entry | 0.012 | 16 | | closet | 0.000 | 2 | | corridor | 0.920 | 5,196 | | dining | 0.042 | 145 | | storage | 0.652 | 1,087 | | multipurpose | 0.413 | 23 | | stairs | 0.594 | 786 | | elevator | 0.000 | 11 | | outdoor | 0.074 | 83 | | room_generic | 0.813 | 8,320 | Per-class AP@0.5, seed 0, Korean held-out test: | Class | AP@0.5 | |---|---| | other room (room_generic) | 0.968 | | bedroom | 0.961 | | bathroom | 0.981 | | balcony | 0.948 | | entry | 0.980 | | kitchen | 0.955 | | living | 0.896 | | closet | 0.983 | | outdoor_unit | 0.988 | | stairs | 0.958 | | elevator_hall | 0.914 | | elevator | 0.974 | | multipurpose | 0.949 | ## Limitations - **Swiss Dwellings: the low macro score (0.498 ± 0.005) is mostly label ambiguity and rare classes.** - Swiss renders carry no furniture, so *bedroom / living / room_generic* are often indistinguishable; the model localizes these rooms but swaps their type (bedroom AP 0.39, living 0.75). The **bedroom <-> room_generic confusion** is the dominant error. - Several classes are nearly absent from Swiss val (closet 2, elevator 11, entry 16, multipurpose 23 boxes) and score 0.00-0.41, which drags the macro average. The **ground-truth-weighted average is 0.848 ± 0.005** (macro 0.498 ± 0.005); report both when comparing. - Swiss **staircase labels are fragmented** (spiral stairs as many tread boxes, straight stairs partially labeled), capping stairs AP at about 0.59. **Storage** rooms (AP 0.65) are often a second guess on top of another room (storage / room_generic confusion). - On the Korean held-out set SPA is strong (0.954 ± 0.004); the Swiss weakness is a property of that benchmark's labels, not evidence of poor performance on furnished Korean plans. - **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) | 181,698 | | Swiss Dwellings v3.0.0 (Zenodo 10.5281/zenodo.7788422, Archilyse AG), rasterized by us | CC BY 4.0 | 18,068 | AI-Hub has no corridor/dining/outdoor labels, Swiss has no entry-hall/utility-room conventions; classes a source does not annotate are masked out of the loss for that source. Training: 6 epochs, AdamW, batch 12, 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/). 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} } ``` 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): 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_spa_2026, title = {floorplan-dfine-spa: D-FINE floor-plan spaces / rooms detector}, author = {digitalpresso}, year = {2026}, howpublished = {Hugging Face model repository}, url = {https://huggingface.co/digitalpresso/floorplan-dfine-spa} } ```