OsamaMo commited on
Commit
e9802f8
·
verified ·
1 Parent(s): edbf290

Update 2DPlan2Strct model card and inference default

Browse files
Files changed (2) hide show
  1. README.md +15 -9
  2. inference.py +1 -1
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
  language: en
3
- model_name: 2D Floor Plan Component Detector
4
  pipeline_tag: object-detection
5
  tags:
6
  - floor-plan
@@ -11,10 +11,12 @@ metrics:
11
  - map
12
  license: other
13
  license_name: non-commercial-research-only
14
- license_link: https://huggingface.co/OsamaMo/2d-floor-plan-component-detector/blob/main/USAGE_TERMS.md
15
  ---
16
 
17
- # 2D Floor Plan Component Detector
 
 
18
 
19
  Detect **walls, rooms, doors, and windows** in 2D floor-plan images. Inference runs locally after the weights are downloaded from Hugging Face. It returns a JSON file with detections and an annotated PNG. Walls and rooms are represented by bounding boxes, not segmentation masks.
20
 
@@ -22,8 +24,8 @@ Detect **walls, rooms, doors, and windows** in 2D floor-plan images. Inference r
22
 
23
  | Before detection | After detection |
24
  | :---: | :---: |
25
- | ![Floor plan before detection](https://huggingface.co/OsamaMo/2d-floor-plan-component-detector/resolve/main/images/before_detection.webp) | ![Same floor plan with detected walls, rooms, doors, and windows highlighted](https://huggingface.co/OsamaMo/2d-floor-plan-component-detector/resolve/main/images/after_detection.png) |
26
- | ![Second floor plan before detection](https://huggingface.co/OsamaMo/2d-floor-plan-component-detector/resolve/main/images/before_rec_2.jpeg) | ![Second floor plan with detected walls, rooms, doors, and windows highlighted](https://huggingface.co/OsamaMo/2d-floor-plan-component-detector/resolve/main/images/after_rec_2.png) |
27
 
28
  ## Quick start
29
 
@@ -31,7 +33,7 @@ Use Python 3.10–3.12. In a clean virtual environment, install the requirements
31
 
32
  ```bash
33
  python -m pip install "huggingface_hub>=0.25"
34
- hf download OsamaMo/2d-floor-plan-component-detector inference.py requirements.txt --local-dir floorplan-inference
35
  python -m pip install -r floorplan-inference/requirements.txt
36
  python floorplan-inference/inference.py path/to/plan.png --output-dir results/plan
37
  ```
@@ -81,7 +83,7 @@ Run this snippet from the directory containing the downloaded `inference.py`, or
81
  Download the configuration and checkpoint while online, then point the inference script at the local directory:
82
 
83
  ```bash
84
- hf download OsamaMo/2d-floor-plan-component-detector config.json checkpoint_best_ema.pth --local-dir floorplan-model
85
  python floorplan-inference/inference.py path/to/plan.png --model-dir floorplan-model --output-dir results/plan
86
  ```
87
 
@@ -110,7 +112,7 @@ Scores can change with drawing style, scan quality, and confidence threshold. In
110
  To measure both devices on your own machine, download `benchmark.py` alongside `inference.py`, then run:
111
 
112
  ```bash
113
- hf download OsamaMo/2d-floor-plan-component-detector benchmark.py inference.py --local-dir floorplan-inference
114
  python floorplan-inference/benchmark.py path/to/plan.png --device both --warmups 3 --repeats 20
115
  ```
116
 
@@ -125,6 +127,10 @@ The benchmark reports `CUDA: unavailable` when the machine has no CUDA GPU. It s
125
  - Default confidence threshold: `0.35`; tune for your drawings
126
  - Supported use: non-commercial research and evaluation, subject to [usage terms](USAGE_TERMS.md)
127
 
 
 
 
 
128
  ## Download tracking
129
 
130
  Hugging Face displays a download count on this model page. The script retrieves `config.json`, which the Hub counts as a model download. The count represents file requests, **not unique people** or model-card readers. To retrieve the current count programmatically:
@@ -132,6 +138,6 @@ Hugging Face displays a download count on this model page. The script retrieves
132
  ```python
133
  from huggingface_hub import HfApi
134
 
135
- info = HfApi().model_info("OsamaMo/2d-floor-plan-component-detector")
136
  print(info.downloads)
137
  ```
 
1
  ---
2
  language: en
3
+ model_name: 2DPlan2Strct
4
  pipeline_tag: object-detection
5
  tags:
6
  - floor-plan
 
11
  - map
12
  license: other
13
  license_name: non-commercial-research-only
14
+ license_link: https://huggingface.co/OsamaMo/2dplan2strct/blob/main/USAGE_TERMS.md
15
  ---
16
 
17
+ # 2DPlan2Strct
18
+
19
+ ### From Floor Plan Images to Structured Architectural Understanding
20
 
21
  Detect **walls, rooms, doors, and windows** in 2D floor-plan images. Inference runs locally after the weights are downloaded from Hugging Face. It returns a JSON file with detections and an annotated PNG. Walls and rooms are represented by bounding boxes, not segmentation masks.
22
 
 
24
 
25
  | Before detection | After detection |
26
  | :---: | :---: |
27
+ | ![Floor plan before detection](https://huggingface.co/OsamaMo/2dplan2strct/resolve/main/images/before_detection.webp) | ![Same floor plan with detected walls, rooms, doors, and windows highlighted](https://huggingface.co/OsamaMo/2dplan2strct/resolve/main/images/after_detection.png) |
28
+ | ![Second floor plan before detection](https://huggingface.co/OsamaMo/2dplan2strct/resolve/main/images/before_rec_2.jpeg) | ![Second floor plan with detected walls, rooms, doors, and windows highlighted](https://huggingface.co/OsamaMo/2dplan2strct/resolve/main/images/after_rec_2.png) |
29
 
30
  ## Quick start
31
 
 
33
 
34
  ```bash
35
  python -m pip install "huggingface_hub>=0.25"
36
+ hf download OsamaMo/2dplan2strct inference.py requirements.txt --local-dir floorplan-inference
37
  python -m pip install -r floorplan-inference/requirements.txt
38
  python floorplan-inference/inference.py path/to/plan.png --output-dir results/plan
39
  ```
 
83
  Download the configuration and checkpoint while online, then point the inference script at the local directory:
84
 
85
  ```bash
86
+ hf download OsamaMo/2dplan2strct config.json checkpoint_best_ema.pth --local-dir floorplan-model
87
  python floorplan-inference/inference.py path/to/plan.png --model-dir floorplan-model --output-dir results/plan
88
  ```
89
 
 
112
  To measure both devices on your own machine, download `benchmark.py` alongside `inference.py`, then run:
113
 
114
  ```bash
115
+ hf download OsamaMo/2dplan2strct benchmark.py inference.py --local-dir floorplan-inference
116
  python floorplan-inference/benchmark.py path/to/plan.png --device both --warmups 3 --repeats 20
117
  ```
118
 
 
127
  - Default confidence threshold: `0.35`; tune for your drawings
128
  - Supported use: non-commercial research and evaluation, subject to [usage terms](USAGE_TERMS.md)
129
 
130
+ ## Training setup
131
+
132
+ The model was trained on an NVIDIA T4 GPU with 16 GB of memory. The reported training duration was 16 hours.
133
+
134
  ## Download tracking
135
 
136
  Hugging Face displays a download count on this model page. The script retrieves `config.json`, which the Hub counts as a model download. The count represents file requests, **not unique people** or model-card readers. To retrieve the current count programmatically:
 
138
  ```python
139
  from huggingface_hub import HfApi
140
 
141
+ info = HfApi().model_info("OsamaMo/2dplan2strct")
142
  print(info.downloads)
143
  ```
inference.py CHANGED
@@ -17,7 +17,7 @@ from PIL import Image, ImageDraw
17
  from rfdetr import RFDETRMedium
18
 
19
 
20
- DEFAULT_REPO_ID = "OsamaMo/2d-floor-plan-component-detector"
21
  COLORS = {
22
  "wall": "#e63946",
23
  "room": "#457b9d",
 
17
  from rfdetr import RFDETRMedium
18
 
19
 
20
+ DEFAULT_REPO_ID = "OsamaMo/2dplan2strct"
21
  COLORS = {
22
  "wall": "#e63946",
23
  "room": "#457b9d",