add model
Browse files- .gitattributes +1 -0
- README.md +108 -0
- config.json +1 -0
- model.pt +3 -0
.gitattributes
CHANGED
|
@@ -33,3 +33,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 33 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
model.pt filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,3 +1,111 @@
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: apache-2.0
|
| 3 |
+
library_name: hatchfinder
|
| 4 |
+
pipeline_tag: image-segmentation
|
| 5 |
+
tags:
|
| 6 |
+
- hatchfinder
|
| 7 |
+
- image-segmentation
|
| 8 |
+
- blueprint
|
| 9 |
+
- floorplan
|
| 10 |
+
- hatching
|
| 11 |
+
- pattern-matching
|
| 12 |
+
- reference-image
|
| 13 |
+
- architecture
|
| 14 |
+
- construction
|
| 15 |
+
- bim
|
| 16 |
+
- pytorch
|
| 17 |
---
|
| 18 |
+
|
| 19 |
+
# GreenMap/hatch-finder-3.5m
|
| 20 |
+
|
| 21 |
+
HatchFinder is a lightweight reference-conditioned model for locating a given hatch pattern in architectural and construction drawings.
|
| 22 |
+
|
| 23 |
+
The model takes a blueprint, a search mask defining the region of interest, and a reference image of the hatch pattern to find. It produces a dense pixel-wise heatmap indicating where the reference hatch is present.
|
| 24 |
+
|
| 25 |
+
**GitHub:** [GreenMap-chan/hatch-finder](https://github.com/GreenMap-chan/hatch-finder)
|
| 26 |
+
|
| 27 |
+
## Overview
|
| 28 |
+
|
| 29 |
+
HatchFinder is designed for reference-based hatch detection rather than classification into a fixed set of hatch classes.
|
| 30 |
+
|
| 31 |
+
- Finds a hatch pattern provided as a reference image.
|
| 32 |
+
- Produces a dense pixel-wise probability heatmap.
|
| 33 |
+
- Uses a search mask to restrict detection to selected regions of the drawing.
|
| 34 |
+
- Does not require the target hatch to belong to a predefined class.
|
| 35 |
+
- Designed for architectural plans, construction drawings, and similar technical documents.
|
| 36 |
+
- Approximately 3.5M parameters.
|
| 37 |
+
|
| 38 |
+
## Inputs
|
| 39 |
+
|
| 40 |
+
The model takes three inputs:
|
| 41 |
+
|
| 42 |
+
- **Drawing** — RGB image of the architectural or construction drawing.
|
| 43 |
+
- **Search mask** — binary mask specifying the region in which the hatch should be searched for.
|
| 44 |
+
- **Reference hatch** — RGB image containing an example of the hatch pattern to locate.
|
| 45 |
+
|
| 46 |
+
## Output
|
| 47 |
+
|
| 48 |
+
The model outputs a single-channel dense logits map with the same spatial resolution as the drawing.
|
| 49 |
+
|
| 50 |
+
After applying sigmoid, each pixel represents the predicted probability that it belongs to the reference hatch pattern.
|
| 51 |
+
|
| 52 |
+
```python
|
| 53 |
+
heatmap = torch.sigmoid(logits)
|
| 54 |
+
heatmap = heatmap * search_mask
|
| 55 |
+
```
|
| 56 |
+
|
| 57 |
+
## Architecture
|
| 58 |
+
|
| 59 |
+
HatchFinder uses a custom multi-scale convolutional architecture consisting of:
|
| 60 |
+
|
| 61 |
+
- Multi-scale drawing encoder.
|
| 62 |
+
- Multi-scale reference hatch encoder.
|
| 63 |
+
- Learned drawing-to-reference matching features.
|
| 64 |
+
- Gated multi-scale matching.
|
| 65 |
+
- FiLM-based reference conditioning.
|
| 66 |
+
- U-Net-like heatmap decoder.
|
| 67 |
+
|
| 68 |
+
The model is trained end-to-end for reference-conditioned pixel-level hatch detection.
|
| 69 |
+
|
| 70 |
+
## Validation Metrics
|
| 71 |
+
|
| 72 |
+
| Metric | Value |
|
| 73 |
+
|--------|------:|
|
| 74 |
+
| Validation loss | 0.05881 |
|
| 75 |
+
| BCE loss | 0.01343 |
|
| 76 |
+
| Dice loss | 0.05672 |
|
| 77 |
+
| Dice coefficient | 0.94328 |
|
| 78 |
+
|
| 79 |
+
The metrics above were measured on the validation split used for this model and should not be interpreted as performance on arbitrary blueprint datasets.
|
| 80 |
+
|
| 81 |
+
## Training
|
| 82 |
+
|
| 83 |
+
- Task: Reference-conditioned hatch segmentation
|
| 84 |
+
- Framework: PyTorch
|
| 85 |
+
- Parameters: ~3.5M
|
| 86 |
+
- Loss: Masked BCEWithLogits + Dice loss
|
| 87 |
+
- Training examples: 7,000
|
| 88 |
+
- Input: RGB drawing + binary search mask + RGB reference hatch
|
| 89 |
+
- Output: Pixel-wise hatch logits
|
| 90 |
+
|
| 91 |
+
Training includes geometric and visual augmentations applied independently where appropriate to the drawing and reference hatch.
|
| 92 |
+
|
| 93 |
+
## Installation
|
| 94 |
+
|
| 95 |
+
```bash
|
| 96 |
+
pip install hatchfinder
|
| 97 |
+
```
|
| 98 |
+
|
| 99 |
+
## Usage
|
| 100 |
+
|
| 101 |
+
```python
|
| 102 |
+
from hatchfinder import HatchFinder
|
| 103 |
+
|
| 104 |
+
model = HatchFinder("model.pt")
|
| 105 |
+
```
|
| 106 |
+
|
| 107 |
+
See the hatch-finder [repository](https://github.com/GreenMap-chan/hatch-finder) for training, preprocessing, and inference examples.
|
| 108 |
+
|
| 109 |
+
## License
|
| 110 |
+
|
| 111 |
+
Apache License 2.0
|
config.json
ADDED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
{}
|
model.pt
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:47fcc870796d5e3f68dbdef1b3069911105585643350e66fdd6d2026eb9a762b
|
| 3 |
+
size 14104743
|