1. Introduction
In architecture, engineering, construction (AEC), and real estate, the 2D floor plan remains a common medium for communicating spatial layouts. For
existing buildings, raster floor plans (JPEG, PNG, and PDF scans) are often the only available documentation: BIM or IFC models [
1] may never have been created, or may be outdated relative to as-built conditions. In this setting, pixel-based reconstruction from 2D images is a practical entry point for area estimation, inventory extraction, and preliminary compliance screening, tasks that cannot be delegated to BIM-native workflows when no digital model exists. These diagrams encode geometric and semantic information, including room dimensions, wall layout, and furniture placement. However, automated extraction from unstructured images remains challenging because of variability in drawing styles, scan noise, and densely packed symbols.
Historically, floor plan understanding relied on traditional image processing and rule-based methods. Techniques such as edge detection, Hough transforms, and morphological operations were used to detect lines and infer wall structures [
2]. These approaches work reasonably on standardized CAD exports but degrade on hand-drawn sketches or noisy scans.
Convolutional Neural Networks (CNNs) [
3] have improved document image analysis substantially. Object detectors such as YOLO [
4] localize discrete symbols efficiently, while encoder–decoder networks such as U-Net [
5] support pixel-level segmentation. Much prior work treats detection and segmentation separately and does not integrate them into a pipeline that yields calibrated physical metrics (e.g., room areas in square meters) for legacy documentation workflows.
Accordingly, this paper targets the digitization and assessment of existing building stock from raster floor plans. We combine object detection, semantic segmentation, scale-based area calculation, and LLM-based compliance screening [
6,
7] in a single pipeline accessible through a web interface [
8]. The LLM module does not replace BIM-native code checking; it provides interpretive, document-grounded feedback on extracted metrics when only 2D plans are available (e.g., property survey, renovation feasibility review, or preliminary screening before detailed architectural review).
The primary contributions are:
A hybrid vision pipeline using YOLOv8 [
9] for 18-class symbol detection and a ResNet34-backed U-Net [
5,
10] for wall and room segmentation.
Dual augmentation workflows applied after plan-level splitting: deterministic flip/rotation for detection labels, and Albumentations-based [
11] offline image–mask expansion for segmentation, with label-aligned transforms in both cases.
A user-interactive scale-calibration module (Streamlit [
8] sidebar) that converts segmentation masks into m
2 estimates conditional on operator-supplied reference dimensions, not independent blueprint verification.
Integration of a local LLM via Ollama [
12] with a RAG pipeline [
7] to support compliance-oriented assessment of existing layouts from structured vision outputs, with documented knowledge-base sources.
Deployment in a Streamlit web application [
8] for upload, visualization, reporting, and advisory LLM output.
Baseline and cross-dataset evaluation: in-domain comparison with DeepLabv3+ [
13] and Faster R-CNN [
14] under matched data splits and evaluation protocols, and fine-tuning experiments on CubiCasa5K [
15].
3. Methodology
Our system comprises four modules: (1) object detection, (2) semantic segmentation, (3) scale-based area calculation, and (4) LLM-based compliance assessment.
Figure 1 summarizes the workflow.
3.1. Dataset Preparation and Augmentation Strategy
We curated 101 unique high-resolution raster floor plan images with dual annotations:
Detection labels: LabelImg [
17] bounding boxes for 18 classes (e.g.,
door, window, bed, dining table, sofa, TV, cupboard, toilet, washbasin, washing machine, and air condition), stored in YOLO format [
4,
9].
Segmentation labels: LabelMe [
18] polygons for
wall and
room, converted to categorical masks via a custom script.
Corpus characteristics. The 101 source plans are high-resolution
residential-style raster layouts with orthogonal walls and standard furniture symbols (1–10 rooms per plan; image widths roughly 200–2000 px). They reflect common modern apartment/house conventions used in our annotation workflow but are not stratified by country, building era, or drawing author. Hand-drawn sketches, non-orthogonal layouts, and commercial/industrial plans are under-represented. We therefore treat in-domain metrics as strong within this style family only; CubiCasa5K fine-tuning (
Section 4.2) partially probes transfer to a public benchmark but does not substitute for broader geographic or typological coverage.
Plan-level splitting. Before augmentation, the 101 source plans are partitioned into training (81 plans, 80%), validation (10 plans, 10%), and test (10 plans, 10%) using random seed 42. All augmented variants of a given source plan inherit its split assignment, so no flipped or rotated copy of a test plan appears in training.
Detection and segmentation follow different augmentation workflows suited to their label formats (bounding boxes vs. pixel masks).
3.1.1. Detection Augmentation (Label-Aligned Geometric Transforms)
For each source plan within a split, we generated two deterministic variants: horizontal flip and 90° counter-clockwise rotation, with coordinate transforms applied to YOLO bounding boxes (
Figure 2 and
Figure 3). This yields up to 303 images (3 views × 101 plans), although statistical generalization claims rest on 101 independent source plans; augmented views are correlated training samples, not independent observations.
3.1.2. Segmentation Augmentation (Offline Albumentations Pipeline)
Segmentation requires
joint transforms on image and mask so wall/room boundaries remain aligned. We pre-generate augmented pairs offline with an Albumentations pipeline [
11] (project script:
augment_segmentation_data.py) and store them in the offline segmentation-augmented corpus (
segmentation_augmented/, with paired
images/ and
masks/ subfolders). For each annotated source plan, the script retains the original image–mask pair and synthesizes multiple stochastic variants; outputs append suffixes
_aug01–
_aug10 to the source filename stem.
Each augmentation sample applies a composed pipeline (
Table 1,
Figure 4): (1) one mandatory geometric transform (horizontal flip, vertical flip, or rotation by 90°/180°/270°); (2) with probability 0.5, one elastic/grid/optical distortion to mimic scan warping; (3) with probability 0.7, photometric adjustment (brightness/contrast, gamma, or CLAHE); and (4) with probability 0.5, noise or blur to simulate low-quality scans. All operators use Albumentations’ dual
image/
mask interface so polygon-derived labels stay pixel aligned.
During U-Net training, additional
online augmentation (resize to 384 × 384, random horizontal flip, ±15° rotation, mild brightness/contrast) is applied on the fly. The offline segmentation-augmented corpus supports segmentation baseline comparison (
Section 4.2) where a fixed, reproducible image–mask set is required.
3.2. Furniture and Fixture Detection Module
We use YOLOv8-nano [
9] for a practical speed–accuracy trade-off. Training combines distribution focal loss (DFL), complete IoU (CIoU), and binary cross-entropy (BCE) objectives as defined in the Ultralytics YOLOv8 training framework [
9].
3.3. Room and Wall Segmentation Module
Wall and room extraction uses U-Net [
5] with a ResNet34 encoder [
10] pretrained on ImageNet [
19]. To address class imbalance, we optimize a combined cross-entropy and Dice loss [
20]:
with fixed weights
(equal contribution of pixel classification and region overlap), set empirically at the start of training and kept unchanged; no hyperparameter search over
or
is performed.
Detection vs. segmentation roles for walls. The
loadbearing_wall detection class marks symbolically drawn structural wall segments as discrete objects for inventory and downstream LLM context (
Section 4.3). Continuous wall topology and room envelopes are derived from the U-Net segmentation mask (classes
wall and
room), which drives area calculation. The two outputs are complementary: detection supports fixture-level counts; segmentation supports metric extraction. They are not merged into a single geometric representation.
3.4. Real-World Area Calculation Algorithm
Raster floor plans generally lack reliable embedded scale metadata. Absolute areas are therefore not inferred automatically from pixels alone; they depend on operator-controlled scale calibration in the web application (Settings sidebar).
The user sets Reference Length (pixels) and Actual Length (cm), for example by matching a door opening to a nominal 90 cm leaf, or by iteratively adjusting both fields until displayed room totals align with a trusted external figure (lease schedule, manual takeoff, or site measurement). Changing the scale directly changes the reported m2 values; this is intentional workflow behavior, not post hoc correction of a fixed absolute measurement.
With pixel length
and physical length
,
The predicted
room mask is decomposed via connected-component labeling [
21]; room
i area is
Reported areas are
calibrated estimates: they reflect the chosen reference scale together with U-Net segmentation. This study does not validate absolute m
2 against independent blueprint drawings;
Section 4.5 evaluates internal consistency and calibration sensitivity instead. Relative room proportions and rankings remain meaningful even when absolute scale is uncertain; absolute m
2 values require a trustworthy reference dimension or external check. Automated scale-bar or OCR-based calibration is
not implemented in the current system (
Section 6).
3.5. LLM-Integrated Compliance Assessment and RAG Pipeline
Rather than generative co-design, the LLM module supports the assessment of existing layouts: it consumes JSON-serialized vision outputs (room areas, furniture counts, and adjacency) and produces readable compliance-oriented commentary for surveyors or owners when BIM-based rule engines are unavailable.
3.5.1. Local Deployment via Ollama
Open-source models (e.g., Qwen2.5 [
22]) run locally via Ollama [
12] so sensitive plan data need not leave the deployment environment.
3.5.2. Retrieval-Augmented Generation (RAG)
A ChromaDB [
23] vector store holds embedded excerpts from documented sources (
Table 2). At inference, the system retrieves passages relevant to detected conditions (e.g., a room below the GB 50096-2011 double-bedroom usable-area minimum of 9 m
2, such as Room 8 at 3.49 m
2 in the demonstration plan) and injects them into the prompt following the RAG paradigm [
7].
The 9 m
2 threshold used in screening refers to the minimum
usable area of a double bedroom in GB 50096-2011 (Code for design of residential buildings), Clause 5.2.1(1) [
24]. Retrieved excerpts also include the 5 m
2 single-bedroom minimum (Clause 5.2.1(2)). Thresholds are applied for
preliminary screening only when room use is supplied or inferred; local codes and licensed review take precedence.
6. Conclusions and Future Work
This study addressed digitization and preliminary compliance screening for existing buildings when only legacy raster floor plans are available. We integrated YOLOv8 symbol detection, ResNet34-U-Net wall/room segmentation, interactive scale calibration, and a locally deployed LLM with RAG into a single Streamlit workflow.
Main results. On the validation split (10 independent source plans), detection reached 92.3% mAP50 and segmentation 95.71% mIoU; U-Net exceeded DeepLabv3+ under matched segmentation training, while YOLOv8 exceeded Faster R-CNN on the same split with differing detection training budgets (
Section 4.2). Cross-dataset fine-tuning on CubiCasa5K (82.4% mIoU) indicates reduced transfer to diverse public drawings. Vision inference completes in under 2 s on CPU (
Table 11). A qualitative pilot LLM ablation (
;
Table 10) showed that RAG improved citation of retrieved area thresholds relative to the LLM-only condition, but does not establish regulatory reliability or remove the need for professional review.
Significance and applicability. For property survey, renovation feasibility checks, and inventory extraction from scanned plans, the pipeline offers a practical alternative when BIM models are absent. It is not intended to replace licensed architectural review, blueprint quantity surveying, or BIM-native rule checking. Applicability is strongest for residential-style orthogonal plans similar to our corpus; broader drawing styles require further data and validation.
Outlook. Future work includes OCR-based scale-bar reading, corpus expansion across regions and styles, architect-in-the-loop violation metrics, RPLAN cross-evaluation [
16], LLM quantization for lower latency, and optional export toward BIM—without claiming equivalence to native code-compliance engines.