CoolFace
Apppublic

Dharini27/floorplan-vectorizer

sourceHugging Faceupdated 1y agoView on Hugging Face
14likes
README.md94 linesDownload Raw Back to root
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.