Dharini27/floorplan-vectorizer
14
1---2title: 2D Floorplan Vectorizer3emoji: ๐๏ธ4colorFrom: blue5colorTo: green6sdk: docker7app_file: Dockerfile8pinned: false9---10 11# 2D Floorplan Vectorizer12 13A 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.14 15---16 17## How to Run the App in Local18 191. **Clone the repository:**20 21 ```bash22 git clone <this-repo-link>23 cd inovonics-ui-vectorizer24 ```25 262. **Install the required Python packages:**27 28 ```bash29 pip install -r requirements.txt30 ```31 323. **Download the pretrained model:**33 34 - Download `model_final.pth` from [Google Drive here](https://drive.google.com/file/d/1yr64AOgaYZPTcQzG6cxG6lWBENHR9qjW/view?usp=sharing).35 - Place it inside:36 37 ```plaintext38 floorplan-vectorizer/rcnn_model/output/model_final.pth39 ```40 414. **Run the app:**42 43 ```bash44 python app.py45 ```46 - This is the instruction for running the model in local, this will open up the app in localhost.47 485. Open your browser at [http://localhost:xxxx](http://localhost:xxxx) to start using the app!49 50---51 52## Project Structure53 54--- 55```plaintext56floorplan-vectorizer/57โโโ app.py # Gradio frontend app58โโโ public/59โ โโโ logo.png # App logo60โโโ rcnn_model/61โ โโโ extraction/ # Extract information from uploaded png image62โ โ โโโ annotation_builder.py 63โ โ โโโ floorplan_sampler.py64โ โ โโโ from_labelme_runner.py65โ โ โโโ svg_to_json.py 66โ โโโ output/ # Empty folder while cloning. Place the pth file here67โ โโโ preprocessing/ # Preprocess the image before sending to model68โ โ โโโ cleaning_images.py 69โ โ โโโ cleaning_single_image.py 70โ โ โโโ splitting_dataset.py71โ โ โโโ svg_to_yolo.py 72โ โโโ results/ # Empty folder while cloning. The resulting image and JSON will be stored here73โ โโโ sample/ # Sample images for the model 74โ โโโ scripts/ # Model training, evaluation and inference. Streamlit runs the rcnn_run.py file from the frontend75โ โ โโโ rcnn_config.py 76โ โ โโโ rcnn_eval.py 77โ โ โโโ rcnn_full_tuner.py 78โ โ โโโ rcnn_run.py 79โ โ โโโ rcnn_train.py 80โ โโโ uploads/ # Temporary folder for streamlit to store the user uploaded image81โ โโโ utils/ # Utility functions during model train and preprocessing82โ โ โโโ coco_to_inovonics_json.py83โ โ โโโ floorplan_vectorizer_utils.py84โ โ โโโ inovonics_ann_builder.py85โโโ README.md # (this file)86โโโ requirements.txt # Python dependencies87โโโ .gitignore # Files to ignore during Git commits88```89---90 91## Huggingface Model92 93The model is currently running in this [HuggingFace Space](https://huggingface.co/spaces/Dharini27/floorplan-vectorizer) 94Upload 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.