leo-binnies's picture
Upload README.md with huggingface_hub
8d4f58e verified
|
Raw
History Blame Contribute Delete
5.43 kB
metadata
task_categories:
  - image-to-text
task_ids:
  - image-captioning
language:
  - en
tags:
  - floorplan
  - vlm
  - vectorization
  - structured-output
  - architecture
  - vision-language
  - unsloth
size_categories:
  - 1K<n<10K
license: cc-by-4.0
datasets:
  - name: CubiCasa5K
    url: https://github.com/CubiCasa/CubiCasa5k
    description: >-
      Original floorplan image dataset with 5000 annotated floor plans.
      Annotations are SVG polygons covering 80+ floorplan object categories.
library_name: datasets
pretty_name: FloorplanVLM SFT Dataset (Flat)

FloorplanVLM SFT Dataset (Flat)

A flattened HuggingFace dataset optimized for Unsloth Studio and other tools requiring flat column formats for VLM fine-tuning.

This is the flat version of BinniesHK-AI/floorplan-vlm-sft-dataset, which uses a chat-based messages format.

Dataset Description

  • Task: Image-to-text (floor plan → structured JSON)
  • Source: CubiCasa5K (5000 real floor plans from Finnish architectural drawings)
  • Conversion: SVG polygon annotations → structured JSON with walls, doors, windows, and rooms
  • Format: Flat columns (image, instruction, json_string) — ready for Unsloth Studio
  • Splits: Train (4142), Validation (397), Test (394)

Dataset Structure

Column Type Description
image PIL.Image Floor plan image (F1_scaled.png from CubiCasa5K)
instruction str Combined system + user prompt (single text field for training)
json_string str Raw JSON annotation of the floor plan

Example

from datasets import load_dataset

ds = load_dataset("BinniesHK-AI/floorplan-vlm-sft-dataset-flat", split="train")
sample = ds[0]

print(sample["instruction"][:200])
# "You are a floor plan analysis assistant. Convert the floor plan image to structured JSON.\n\nAnalyze the provided floor plan image and output a JSON object..."

print(sample["json_string"][:200])
# '{"rooms": [{"type": "living_room", "area": 25.5, "points": [[100, 200], ...]}, ...]}'

Usage with Unsloth Studio

  1. Go to Unsloth Studio
  2. Select Upload DatasetHuggingFace
  3. Enter: BinniesHK-AI/floorplan-vlm-sft-dataset-flat
  4. Map columns:
    • Image: image
    • Instruction: instruction
    • Output: json_string

Usage with TRL SFTTrainer

from datasets import load_dataset
from trl import SFTTrainer, SFTConfig

ds = load_dataset("BinniesHK-AI/floorplan-vlm-sft-dataset-flat", split="train")

def formatting_func(examples):
    """Wrap instruction + json_string into chat messages."""
    texts = []
    for inst, js in zip(examples["instruction"], examples["json_string"]):
        texts.append([
            {"role": "user", "content": [{"type": "image"}, {"type": "text", "text": inst}]},
            {"role": "assistant", "content": [{"type": "text", "text": js}]},
        ])
    return texts

trainer = SFTTrainer(
    model=model,
    train_dataset=ds,
    args=SFTConfig(output_dir="./output", max_seq_length=4096),
    formatting_func=formatting_func,
)
trainer.train()

Instruction Format

The instruction column contains the combined system and user prompt:

You are a floor plan analysis assistant. Convert the floor plan image to structured JSON.

Analyze the provided floor plan image and output a JSON object with the following structure:
{
  "rooms": [{"type": str, "area": float, "points": [[x, y], ...]}],
  "walls": [{"points": [[x1, y1], [x2, y2]], "width": float}],
  "doors": [{"position": [x, y], "width": float, "rotation": float}],
  "windows": [{"position": [x, y], "width": float, "rotation": float}]
}

Focus on accurately identifying room types, boundaries, and structural elements.

JSON Annotation Format

The json_string column contains the raw JSON output:

{
  "rooms": [
    {
      "type": "living_room",
      "area": 25.5,
      "points": [[100, 200], [300, 200], [300, 400], [100, 400]]
    },
    {
      "type": "bedroom",
      "area": 15.2,
      "points": [[300, 200], [500, 200], [500, 400], [300, 400]]
    }
  ],
  "walls": [
    {"points": [[100, 200], [500, 200]], "width": 0.2}
  ],
  "doors": [
    {"position": [200, 300], "width": 0.9, "rotation": 0}
  ],
  "windows": [
    {"position": [400, 200], "width": 1.2, "rotation": 0}
  ]
}

Room Types

The dataset includes 80+ floor plan object categories from CubiCasa5K, including:

  • Rooms: living_room, bedroom, kitchen, bathroom, hallway, etc.
  • Structures: wall, door, window, stairs, elevator
  • Fixtures: sink, toilet, bathtub, shower, stove, oven
  • Furniture: bed, sofa, table, chair, desk, cabinet

Data Splits

Split Samples Description
train 4,142 Training set
validation 397 Validation set
test 394 Test set

Note: 67 samples were filtered out due to SVG parse failures or oversized JSON annotations (>10KB).

Citation

@inproceedings{Mai2019CubiCasa,
  title={CubiCasa5K: A Dataset and an Improved Model for Floorplan Recognition},
  author={Mai, Liu and K{\"o}pf, Bernhard and Ballas, Nicolas and Ke, Qi},
  booktitle={International Conference on Document Analysis and Recognition (ICDAR)},
  year={2019}
}

License

Creative Commons Attribution 4.0 International (CC BY 4.0)