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.
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.
-
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
- Python 3.8 or higher
- Tesseract OCR (for text detection)
macOS:
brew install tesseractUbuntu/Debian:
sudo apt-get install tesseract-ocrWindows: Download installer from GitHub
- Clone the repository:
git clone https://github.com/trabulium/FloorPlanAnalyzer.git
cd FloorPlanAnalyzer- Create a virtual environment (recommended):
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate- Install dependencies:
pip install -r requirements.txtRun the GUI application:
python src/main.pyBest overall accuracy using a neural network trained on 5000+ floor plans.
- Adjust minimum room area (100-10000 px²)
- Control smoothing iterations
Classic computer vision approach using watershed segmentation.
- Configure gap closing for doors
- Adjust wall thickness detection
AI-based detection for architectural elements.
- Detects walls, doors, windows, stairs, columns
- Adjustable confidence threshold (10-80%)
Combines YOLO's element detection with OCR text recognition.
- Best for floor plans with clear text labels
- Load Image: Click "Load Floor Plan" to select your image
- Calibrate Scale (optional): Use known dimensions for accurate measurements
- Select Method: Choose detection method based on your floor plan
- Detect: Click "Detect Rooms & Doors" to analyze
- Edit (optional):
- Select rooms from the list
- Edit room types or resize dimensions
- Remove unwanted detections
- Export: Save as SVG or JSON
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
This project builds upon several excellent open-source projects:
- 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
- Base Model: Ultralytics YOLOv8
- Training Dataset: Custom floor plan dataset
- License: AGPL-3.0 License for Ultralytics
- OpenCV for image processing
- PyTorch for deep learning
- Tesseract for OCR functionality
- PyQt5 for the graphical interface
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
IMPORTANT: This software is for NON-COMMERCIAL USE ONLY due to third-party license restrictions.
See the LICENSE file for complete details.
- 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
For commercial use, you must:
- Obtain a commercial license from CubiCasa for the CubiCasa5K model
- Obtain an enterprise license from Ultralytics for YOLOv8
- Either comply with GPL v3 for PyQt5 or obtain a commercial Qt license
When using this software, please provide appropriate attribution to:
- CubiCasa5K: Kalervo et al., "CubiCasa5K: A Dataset and an Improved Multi-Task Model for Floorplan Image Analysis"
- Ultralytics YOLOv8: https://github.com/ultralytics/ultralytics
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}
}For issues, questions, or suggestions, please open an issue on GitHub.
-
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
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