Skip to content

trabulium/FloorPlanAnalyzer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FloorPlanAnalyzer

An experimental floor plan analysis tool with multiple detection methods including deep learning models. Automatically detects rooms, doors, windows, and other architectural elements from floor plan images.

Python PyQt5 License Platform

⚠️ Project Status

This is an experimental project with mixed results. While the tool includes several detection methods (traditional CV, YOLOv8, CubiCasa5K), none have achieved fully reliable room detection across diverse floor plan styles. The CubiCasa5K method shows the most promise but still requires refinement.

This code is being shared in case others want to continue development or use it as a starting point for their own floor plan analysis projects.

Testing: This code has only been tested on macOS (Apple Silicon/ARM). Compatibility with other platforms is unknown.

Features

  • Multiple Detection Methods:

    • Traditional computer vision (watershed segmentation)
    • YOLOv8 AI-based detection
    • CubiCasa5K neural network (state-of-the-art)
    • Hybrid approach combining YOLO and OCR
  • Advanced Capabilities:

    • Automatic room type classification
    • OCR-based text detection for room labels
    • Scale calibration for accurate measurements
    • Room area calculation in square meters
    • Interactive room editing and resizing
    • SVG export for vector graphics
  • User-Friendly GUI:

    • Dynamic controls based on selected method
    • Real-time visualization with color-coded rooms
    • Editable room list with type modification
    • Zoom functionality for detailed inspection

Installation

Prerequisites

  • Python 3.8 or higher
  • Tesseract OCR (for text detection)

Install Tesseract:

macOS:

brew install tesseract

Ubuntu/Debian:

sudo apt-get install tesseract-ocr

Windows: Download installer from GitHub

Setup

  1. Clone the repository:
git clone https://github.com/trabulium/FloorPlanAnalyzer.git
cd FloorPlanAnalyzer
  1. Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate
  1. Install dependencies:
pip install -r requirements.txt

Usage

Quick Start

Run the GUI application:

python src/main.py

Detection Methods

1. CubiCasa5K (Recommended)

Best overall accuracy using a neural network trained on 5000+ floor plans.

  • Adjust minimum room area (100-10000 px²)
  • Control smoothing iterations

2. Traditional (Watershed)

Classic computer vision approach using watershed segmentation.

  • Configure gap closing for doors
  • Adjust wall thickness detection

3. YOLOv8

AI-based detection for architectural elements.

  • Detects walls, doors, windows, stairs, columns
  • Adjustable confidence threshold (10-80%)

4. Hybrid (YOLO + OCR)

Combines YOLO's element detection with OCR text recognition.

  • Best for floor plans with clear text labels

Workflow

  1. Load Image: Click "Load Floor Plan" to select your image
  2. Calibrate Scale (optional): Use known dimensions for accurate measurements
  3. Select Method: Choose detection method based on your floor plan
  4. Detect: Click "Detect Rooms & Doors" to analyze
  5. Edit (optional):
    • Select rooms from the list
    • Edit room types or resize dimensions
    • Remove unwanted detections
  6. Export: Save as SVG or JSON

Project Structure

FloorPlanAnalyzer/
├── src/
│   ├── main.py           # Main GUI application
│   ├── detector.py        # Core detection algorithms
│   └── yolo_detector.py   # YOLO integration
├── models/
│   ├── cubicasa/          # CubiCasa5K model files
│   └── yolo/              # YOLOv8 model weights
├── examples/              # Sample floor plans
├── docs/                  # Documentation
└── tests/                 # Unit tests

Acknowledgments

This project builds upon several excellent open-source projects:

CubiCasa5K

  • Repository: CubiCasa/floortrans
  • Paper: "CubiCasa5K: A Dataset and an Improved Multi-Task Model for Floorplan Image Analysis"
  • License: MIT License
  • The CubiCasa5K model provides state-of-the-art floor plan segmentation

YOLOv8 Floor Plan Detection

  • Base Model: Ultralytics YOLOv8
  • Training Dataset: Custom floor plan dataset
  • License: AGPL-3.0 License for Ultralytics

Dependencies

  • OpenCV for image processing
  • PyTorch for deep learning
  • Tesseract for OCR functionality
  • PyQt5 for the graphical interface

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

IMPORTANT: This software is for NON-COMMERCIAL USE ONLY due to third-party license restrictions.

See the LICENSE file for complete details.

License Summary

  • Our Original Code: MIT License (permissive)
  • CubiCasa5K Integration: Creative Commons BY-NC 4.0 (non-commercial only)
  • YOLOv8 Integration: AGPL-3.0 (copyleft, commercial use requires enterprise license)
  • PyQt5: GPL v3 (copyleft) or Commercial License

Commercial Use

For commercial use, you must:

  1. Obtain a commercial license from CubiCasa for the CubiCasa5K model
  2. Obtain an enterprise license from Ultralytics for YOLOv8
  3. Either comply with GPL v3 for PyQt5 or obtain a commercial Qt license

Attribution Requirements

When using this software, please provide appropriate attribution to:

Citation

If you use this tool in your research, please consider citing:

@software{floorplananalyzer2024,
  title = {FloorPlanAnalyzer: Multi-Method Floor Plan Analysis Tool},
  year = {2024},
  url = {https://github.com/trabulium/FloorPlanAnalyzer}
}

For the CubiCasa5K model:

@article{kalervo2019cubicasa5k,
  title={CubiCasa5K: A Dataset and an Improved Multi-Task Model for Floorplan Image Analysis},
  author={Kalervo, Ahti and Ylioinas, Juha and Häikiö, Markku and Karhu, Antti and Kannala, Juho},
  journal={arXiv preprint arXiv:1904.01920},
  year={2019}
}

Support

For issues, questions, or suggestions, please open an issue on GitHub.

Known Limitations

  • Room Detection Accuracy: Current methods often struggle with:

    • Complex or non-standard floor plan layouts
    • Plans with extensive annotations or furniture
    • Varying wall thickness representations
    • Open floor plans without clear room boundaries
  • Platform Support: Only tested on macOS with Apple Silicon (M1/M2)

  • Model Dependencies: Requires downloading large model files separately

Future Development Ideas

If you want to continue this project, consider:

  • Improving room boundary detection algorithms
  • Training custom models on larger floor plan datasets
  • Adding support for more file formats (DWG, DXF)
  • Implementing automatic dimension extraction
  • Adding 3D visualization capabilities
  • Supporting multi-story buildings
  • Batch processing for multiple floor plans
  • Creating an API for integration with other tools
  • Testing and ensuring compatibility with Windows and Linux

About

Experimental floor plan analysis tool with multiple detection methods including deep learning models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages