Dharini Baskaran
commited on
Commit
·
bce365b
1
Parent(s):
bf8c65c
retract model update
Browse files- README.md +2 -2
- app.py +4 -8
- rcnn_model/scripts/rcnn_eval.py +1 -1
- rcnn_model/scripts/rcnn_run.py +2 -2
README.md
CHANGED
|
@@ -31,11 +31,11 @@ A Gradio web app that allows you to upload 2D floorplan images and automatically
|
|
| 31 |
|
| 32 |
3. **Download the pretrained model:**
|
| 33 |
|
| 34 |
-
- Download `
|
| 35 |
- Place it inside:
|
| 36 |
|
| 37 |
```plaintext
|
| 38 |
-
floorplan-vectorizer/rcnn_model/output/
|
| 39 |
```
|
| 40 |
|
| 41 |
4. **Run the app:**
|
|
|
|
| 31 |
|
| 32 |
3. **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 |
```plaintext
|
| 38 |
+
floorplan-vectorizer/rcnn_model/output/model_final.pth
|
| 39 |
```
|
| 40 |
|
| 41 |
4. **Run the app:**
|
app.py
CHANGED
|
@@ -15,29 +15,25 @@ BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
|
| 15 |
UPLOAD_DIR = "/tmp/uploads/"
|
| 16 |
JSON_DIR = "/tmp/results/"
|
| 17 |
OUTPUT_DIR = "/tmp/output/"
|
| 18 |
-
OUTPUT_DIR2= "/tmp/output2/"
|
| 19 |
MODEL_DIR = os.path.join(BASE_DIR, "rcnn_model", "scripts")
|
| 20 |
logo_path = os.path.join(BASE_DIR, "public", "logo.png")
|
| 21 |
-
model_path = os.path.join(
|
| 22 |
|
| 23 |
# Google Drive model
|
| 24 |
-
GOOGLE_DRIVE_FILE_ID = "
|
| 25 |
GDRIVE_URL = f"https://drive.google.com/uc?id={GOOGLE_DRIVE_FILE_ID}"
|
| 26 |
|
| 27 |
# Create folders
|
| 28 |
os.makedirs(UPLOAD_DIR, exist_ok=True)
|
| 29 |
os.makedirs(JSON_DIR, exist_ok=True)
|
| 30 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
| 31 |
-
os.makedirs(OUTPUT_DIR2, exist_ok=True)
|
| 32 |
|
| 33 |
# Download model if missing
|
| 34 |
if not os.path.exists(model_path):
|
| 35 |
print("Model file not found! Downloading...")
|
| 36 |
try:
|
| 37 |
gdown.download(GDRIVE_URL, model_path, quiet=False, use_cookies=False)
|
| 38 |
-
|
| 39 |
-
raise Exception("Model download failed: File not found after download.")
|
| 40 |
-
print("✅ Model downloaded successfully.")
|
| 41 |
except Exception as e:
|
| 42 |
print(f"Failed to download model: {e}")
|
| 43 |
|
|
@@ -116,4 +112,4 @@ with gr.Blocks() as demo:
|
|
| 116 |
None,
|
| 117 |
[run_button],
|
| 118 |
)
|
| 119 |
-
demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
|
|
|
|
| 15 |
UPLOAD_DIR = "/tmp/uploads/"
|
| 16 |
JSON_DIR = "/tmp/results/"
|
| 17 |
OUTPUT_DIR = "/tmp/output/"
|
|
|
|
| 18 |
MODEL_DIR = os.path.join(BASE_DIR, "rcnn_model", "scripts")
|
| 19 |
logo_path = os.path.join(BASE_DIR, "public", "logo.png")
|
| 20 |
+
model_path = os.path.join(OUTPUT_DIR, "model_final.pth")
|
| 21 |
|
| 22 |
# Google Drive model
|
| 23 |
+
GOOGLE_DRIVE_FILE_ID = "1yr64AOgaYZPTcQzG6cxG6lWBENHR9qjW"
|
| 24 |
GDRIVE_URL = f"https://drive.google.com/uc?id={GOOGLE_DRIVE_FILE_ID}"
|
| 25 |
|
| 26 |
# Create folders
|
| 27 |
os.makedirs(UPLOAD_DIR, exist_ok=True)
|
| 28 |
os.makedirs(JSON_DIR, exist_ok=True)
|
| 29 |
os.makedirs(OUTPUT_DIR, exist_ok=True)
|
|
|
|
| 30 |
|
| 31 |
# Download model if missing
|
| 32 |
if not os.path.exists(model_path):
|
| 33 |
print("Model file not found! Downloading...")
|
| 34 |
try:
|
| 35 |
gdown.download(GDRIVE_URL, model_path, quiet=False, use_cookies=False)
|
| 36 |
+
print("Model downloaded successfully.")
|
|
|
|
|
|
|
| 37 |
except Exception as e:
|
| 38 |
print(f"Failed to download model: {e}")
|
| 39 |
|
|
|
|
| 112 |
None,
|
| 113 |
[run_button],
|
| 114 |
)
|
| 115 |
+
demo.launch(server_name="0.0.0.0", server_port=7860, share=True)
|
rcnn_model/scripts/rcnn_eval.py
CHANGED
|
@@ -23,7 +23,7 @@ def main(cfg,results_filename = "eval_results.txt"):
|
|
| 23 |
#update config file
|
| 24 |
cfg.DATALOADER.NUM_WORKERS = 1
|
| 25 |
cfg.SOLVER.IMS_PER_BATCH = 1
|
| 26 |
-
cfg.MODEL.WEIGHTS = os.path.join(cfg.
|
| 27 |
|
| 28 |
#run evaluation
|
| 29 |
results = standard_evaluation(cfg)
|
|
|
|
| 23 |
#update config file
|
| 24 |
cfg.DATALOADER.NUM_WORKERS = 1
|
| 25 |
cfg.SOLVER.IMS_PER_BATCH = 1
|
| 26 |
+
cfg.MODEL.WEIGHTS = os.path.join(cfg.OUTPUT_DIR, "model_final.pth")
|
| 27 |
|
| 28 |
#run evaluation
|
| 29 |
results = standard_evaluation(cfg)
|
rcnn_model/scripts/rcnn_run.py
CHANGED
|
@@ -13,7 +13,7 @@ from rcnn_model.extraction.annotation_builder import AnnotationBuilder as AnnBui
|
|
| 13 |
|
| 14 |
results_directory = "/tmp/results/"
|
| 15 |
sample_data_directory = "rcnn_model/sample/"
|
| 16 |
-
model_directory = "/tmp/
|
| 17 |
|
| 18 |
def main(cfg,img_source_path, coco_dest_filename, val_img_dest_filename):
|
| 19 |
os.chdir(str(from_root()))
|
|
@@ -22,7 +22,7 @@ def main(cfg,img_source_path, coco_dest_filename, val_img_dest_filename):
|
|
| 22 |
#configure model
|
| 23 |
cfg.DATALOADER.NUM_WORKERS = 1
|
| 24 |
cfg.SOLVER.IMS_PER_BATCH = 1
|
| 25 |
-
cfg.MODEL.WEIGHTS = os.path.join(model_directory, "
|
| 26 |
cfg.MODEL.DEVICE = "cpu"
|
| 27 |
predictor = DefaultPredictor(cfg)
|
| 28 |
|
|
|
|
| 13 |
|
| 14 |
results_directory = "/tmp/results/"
|
| 15 |
sample_data_directory = "rcnn_model/sample/"
|
| 16 |
+
model_directory = "/tmp/output/"
|
| 17 |
|
| 18 |
def main(cfg,img_source_path, coco_dest_filename, val_img_dest_filename):
|
| 19 |
os.chdir(str(from_root()))
|
|
|
|
| 22 |
#configure model
|
| 23 |
cfg.DATALOADER.NUM_WORKERS = 1
|
| 24 |
cfg.SOLVER.IMS_PER_BATCH = 1
|
| 25 |
+
cfg.MODEL.WEIGHTS = os.path.join(model_directory, "model_final.pth")
|
| 26 |
cfg.MODEL.DEVICE = "cpu"
|
| 27 |
predictor = DefaultPredictor(cfg)
|
| 28 |
|