Computer vision answers · Construction

How do I detect walls, doors, windows and rooms in floor plans?

Without tracing every room and counting every door by hand.

Short answer

Train an instance segmentation model to outline every wall, door, window and room in a floor plan with Roboflow for free, then count the results by class. Rooms come back as outlines (masks), so you also get each room's area in pixels to convert with the drawing's scale. Outline walls and rooms as polygons rather than boxes, since a box around an L-shaped room or a diagonal wall covers far more than the shape itself.

Roboflow agent · free to start

Skip the setup. Describe your images.

Describe your images and what you need to find. The agent sets up labeling, training and deployment with you.

Key facts

What you need
Floor plan images and a segmentation model trained on your drawings
What you get
Counts of walls, doors and windows, plus each room's outline and area
Image sources
PDF exports, scanned blueprints and CAD drawings saved as images
Runs on
Cloud API, or your own server running Docker
A software interface displays an AI workflow using a SAM 3 model to segment walls on floor plans, with a workflow diagram and a floor plan image preview.

How to build floor plan detection, step by step

Six steps from a folder of floor plans to counts and room areas you can export.

  1. Connect Roboflow to your coding agent, ChatGPT or Codex

    Add the Roboflow MCP server to Claude, Cursor or Gemini CLI, or install the Roboflow plugin in ChatGPT or Codex. Your assistant can then upload and auto-label floor plans, start training and run the model from a prompt, at no extra cost beyond your Roboflow plan.

  2. Collect plans that match the drawings you will process

    Use floor plans from the same sources you will process, such as PDF exports, scanned blueprints and CAD drawings, saved as images at a consistent resolution. Include the plan styles you expect, for example residential and commercial, and add more wherever the model makes mistakes.

  3. Outline walls, doors, windows and rooms, with one class each

    Draw a polygon around every wall, door, window and room, and give each its own class. Label tightly, so a window starts exactly where the wall ends. Roboflow Annotate can pre-label plans with SAM 3, so you correct outlines instead of drawing each one.

  4. Train an instance segmentation model

    Train an instance segmentation model such as RF-DETR Segmentation on your labeled plans with Roboflow Train. Instance segmentation returns an outline for each object, which is what lets you measure rooms and follow walls that are not straight boxes.

  5. Count each class and measure each room

    Run the trained model on a floor plan, count its results by class name, and read the pixel area of each room.

    Python
    import supervision as sv
    from collections import Counter
    from inference import get_model
    
    model = get_model("your-project/1")
    
    result = model.infer("floor_plan.png", confidence=0.4)[0]
    detections = sv.Detections.from_inference(result)
    
    print(Counter(detections.data["class_name"]))
    # Counter({'wall': 24, 'window': 9, 'door': 7, 'room': 6})
    
    rooms = detections[detections.data["class_name"] == "room"]
    print(rooms.area)  # pixel area of each room outline

    Rather not write code? Ask the Roboflow agent to set this up for you

  6. Run every plan and export the results

    Build a Workflow that runs the model on each floor plan and returns the counts and room areas. Deploy it with Roboflow Deploy to the cloud API or your own server, then convert pixel areas to square feet or square meters using each drawing's scale.

Why 2 million engineers build on Roboflow

  • Label faster

    Auto-label with SAM 3 or your own model, then fix the misses instead of drawing every box.

  • RF-DETR

    Roboflow’s open-source real-time detection model, built for accuracy (opens in a new tab) on small objects.

  • Logic built in

    Counting, zones, tracking and alerts are ready-made Workflow blocks, so there is less code to write.

  • Your model, your weights

    Use your trained weights on every plan, including free, through the open-source Inference package.

  • Run it anywhere

    Self-host on a workstation, Docker, an on-prem GPU or an edge device, or call the cloud API.