Dharini27/floorplan-vectorizer
14
2D Floorplan Vectorizer
A Gradio web app that allows you to upload 2D floorplan images and automatically vectorize them into COCO-style annotations using a trained Mask R-CNN model. The app runs inside a Docker container and is deployed on HuggingFace Spaces for easy public access. It detects and annotates key elements like rooms, walls, doors, and windows.
How to Run the App in Local
- Clone the repository:
git clone <this-repo-link>
cd inovonics-ui-vectorizer- Install the required Python packages:
pip install -r requirements.txt- Download the pretrained model:
- Download
model_final.pthfrom Google Drive here. - Place it inside:
floorplan-vectorizer/rcnn_model/output/model_final.pth- Run the app:
python app.py- This is the instruction for running the model in local, this will open up the app in localhost.
- Open your browser at http://localhost:xxxx to start using the app!
Project Structure
floorplan-vectorizer/
├── app.py # Gradio frontend app
├── public/
│ └── logo.png # App logo
├── rcnn_model/
│ ├── extraction/ # Extract information from uploaded png image
│ │ └── annotation_builder.py
│ │ └── floorplan_sampler.py
│ │ └── from_labelme_runner.py
│ │ └── svg_to_json.py
│ ├── output/ # Empty folder while cloning. Place the pth file here
│ ├── preprocessing/ # Preprocess the image before sending to model
│ │ └── cleaning_images.py
│ │ └── cleaning_single_image.py
│ │ └── splitting_dataset.py
│ │ └── svg_to_yolo.py
│ ├── results/ # Empty folder while cloning. The resulting image and JSON will be stored here
│ ├── sample/ # Sample images for the model
│ ├── scripts/ # Model training, evaluation and inference. Streamlit runs the rcnn_run.py file from the frontend
│ │ └── rcnn_config.py
│ │ └── rcnn_eval.py
│ │ └── rcnn_full_tuner.py
│ │ └── rcnn_run.py
│ │ └── rcnn_train.py
│ ├── uploads/ # Temporary folder for streamlit to store the user uploaded image
│ ├── utils/ # Utility functions during model train and preprocessing
│ │ └── coco_to_inovonics_json.py
│ │ └── floorplan_vectorizer_utils.py
│ │ └── inovonics_ann_builder.py
├── README.md # (this file)
├── requirements.txt # Python dependencies
└── .gitignore # Files to ignore during Git commitsHuggingface Model
The model is currently running in this HuggingFace Space Upload the floorplan image and click on "Run Vectorizer" button, once the model prediction is completed, the floorplan image with detected rooms and the corresponding json will be displayed and ready for download too.
