constructelligence commited on
Commit
dd6defd
·
verified ·
1 Parent(s): dee4b0e

Upload README.md with huggingface_hub

Browse files
Files changed (1) hide show
  1. README.md +198 -0
README.md ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: pytorch
6
+ pipeline_tag: image-segmentation
7
+ tags:
8
+ - image-segmentation
9
+ - semantic-segmentation
10
+ - robotics
11
+ - construction-ai
12
+ - autonomous-painting
13
+ - wall-painting-robot
14
+ - paint-coverage-estimation
15
+ - building-facade
16
+ - drywall
17
+ - skirting-detection
18
+ - window-detection
19
+ - lidar
20
+ - depth-validation
21
+ - deeplabv3
22
+ - mobilenetv3
23
+ - pytorch
24
+ metrics:
25
+ - mean-iou
26
+ - iou
27
+ model-index:
28
+ - name: painting-vision
29
+ results: []
30
+ ---
31
+
32
+ # Painting Vision — robot-ready wall-paint coverage segmentation
33
+
34
+ **A frontier research preview for autonomous painting and surface-finishing robots: from pixels to an executable paint plan.**
35
+
36
+ Painting Vision reads a single camera frame of a wall and returns far more than
37
+ a mask. It segments the paintable surface, the fixtures and openings that must
38
+ not be painted, and the substrate — then hands a downstream planner a *wall
39
+ boundary, corners, a two-tool stroke plan, machine-readable waypoints, and a
40
+ live paint-progress grid*, independently cross-checked against depth/LiDAR.
41
+
42
+ It is built for the hard part of construction robotics: knowing **exactly where
43
+ the wall is, where the keep-outs are, and when the coat is complete**.
44
+
45
+ > Status: research preview. The segmentation architecture, dataset tooling,
46
+ > geometry planner and depth validator are implemented and unit-tested; the
47
+ > model weights are trained by the open `train.py` in this repo on
48
+ > session-separated, real capture data.
49
+
50
+ ---
51
+
52
+ ## Why this model exists
53
+
54
+ General segmentation models tell you a wall is *present*. Painting robots need
55
+ to know:
56
+
57
+ - which pixels are **paintable wall** versus **trim, skirting, openings and fixtures**;
58
+ - the **exact boundary and corners** of the wall, so a roller or spray head does not cross an edge;
59
+ - a **stroke path** that respects a physical clearance margin and lifts over obstacles;
60
+ - the **substrate** (e.g. drywall) so paint behaviour is not confused with surface type;
61
+ - **remaining coverage** across repeated observations, so the robot knows when to stop.
62
+
63
+ Painting Vision is designed end-to-end around those questions.
64
+
65
+ ## Capabilities
66
+
67
+ ### 1. Ten-class semantic segmentation + substrate head
68
+ A configurable backbone (`--arch`: MobileNetV3-Large, ResNet-50/101 DeepLabV3,
69
+ or a modern **SegFormer**) drives a **ten-class semantic head** and an
70
+ **independent drywall-material head**, so paint state and substrate are never
71
+ conflated:
72
+
73
+ `other · wall_unpainted · wall_painted · wall_uncertain · skirting · switch/outlet · AC unit · door · window · wall_obstacle`
74
+
75
+ Painted coverage is reported as `wall_painted / (wall_painted + wall_unpainted)`
76
+ with lower/upper bounds that include uncertain wall area — a confidence-aware
77
+ estimate, not a single false-precise number.
78
+
79
+ ### 2. Window detection you can trust around
80
+ Windows are the most safety-critical keep-out in exterior painting. The
81
+ `window_postprocess` stage merges mullion-split fragments, fits an **oriented
82
+ minimum-area rectangle** with rotating calipers (so a window stays a window at
83
+ any viewing angle), and filters specks and non-window shapes by fill ratio and
84
+ aspect ratio — producing complete, regularised keep-out geometry.
85
+
86
+ ### 3. Robot paint planner
87
+ `robot_planner.py` converts the masks into an executable plan:
88
+
89
+ - ordered **boundary polygon and corners** (Moore-neighbour contour tracing + Douglas-Peucker — it follows real rooflines and voids, not a convex hull);
90
+ - optional **wall-plane rectification** with edge lengths in millimetres;
91
+ - a **two-tool plan**: roller passes for open areas plus **trim/brush passes** for edges and around fixtures the roller cannot reach;
92
+ - **machine-ready waypoints** with paint on/off flags and travel distance;
93
+ - **paint-progress tracking** (`--state`) that targets only what remains and tells the robot when the wall is done.
94
+
95
+ A documented real-facade run lifted planned coverage from **68% (roller only) to
96
+ 97.5% (roller + trim)** on the same wall — the residual is the physically
97
+ unreachable remainder, reported explicitly.
98
+
99
+ ### 4. Depth / LiDAR validation on top of vision
100
+ `depth_validation.py` independently checks the vision output in metric 3D:
101
+ RANSAC wall-plane fitting, protrusion/recess detection (missed pipes or windows),
102
+ recess-versus-window agreement, and a **metric millimetres-per-pixel scale**
103
+ derived from depth instead of guessed — so the planner works in real units.
104
+
105
+ ### 5. Balanced-data tooling
106
+ `data_balance.py` and `audit_dataset.py` score coverage and balance across
107
+ indoor/exterior, substrate, lighting, weather, paint stage and classes, flag
108
+ wall/session leakage and thin classes, and recommend exactly how many more
109
+ samples each gap needs. `train.py` supports class-, wall- and hybrid-balanced
110
+ sampling so the balanced collection survives into the optimizer.
111
+
112
+ ## Quickstart
113
+
114
+ ```sh
115
+ python3 -m pip install -r requirements.txt
116
+
117
+ # 1. Segment a frame
118
+ python3 predict.py frame.jpg --checkpoint artifacts/best.pt \
119
+ --paintable-mask paintable_wall_mask.png \
120
+ --keepout-mask fixture_keepout_mask.png \
121
+ --json result.json --tta
122
+
123
+ # 2. Plan the paint path (optional wall-plane rectification + mm scale)
124
+ python3 robot_planner.py --paintable paintable_wall_mask.png \
125
+ --keepout fixture_keepout_mask.png \
126
+ --corners "80,60 1180,55 1190,700 70,710" \
127
+ --stroke-width 230 --trim-width 60 --overlap 0.2 --margin 40 --mm-per-unit 3.0 \
128
+ --state wall_014.npz --plan plan.json --overlay plan.png
129
+
130
+ # 3. Validate against depth / LiDAR if available
131
+ python3 depth_validate.py --depth depth.npy --intrinsics "fx,fy,cx,cy" \
132
+ --mask painting_mask.png --report validation.json
133
+ ```
134
+
135
+ ## Repository layout
136
+
137
+ | File | Role |
138
+ | --- | --- |
139
+ | `models.py` | architecture factory: DeepLabV3 (MobileNet/ResNet) + SegFormer, semantic + drywall heads |
140
+ | `train.py` | training, balanced sampling, window loss boost, boundary/coverage metrics |
141
+ | `predict.py` | inference: masks, coverage, geometry, regularised windows |
142
+ | `robot_planner.py` | boundary/corners, two-tool stroke plan, waypoints, progress state |
143
+ | `window_postprocess.py` | fragment merge + oriented rectangle fitting for windows |
144
+ | `depth_validation.py` | LiDAR/depth plane fit, protrusion/recess checks, metric scale |
145
+ | `data_balance.py` | coverage/balance analytics |
146
+ | `audit_dataset.py` | dataset audit: schema, leakage, class and domain balance |
147
+ | `fetch_real_data.py` | downloads and converts a real labeled dataset for testing |
148
+ | `smoke_test.py` | end-to-end audit → train → predict → plan |
149
+ | `benchmark.py` | head-to-head vs a generic baseline on the shared wall/window/other subset |
150
+ | `provenance.py` | content-addressed dataset identity, integrity + licence ledger |
151
+ | `safety_gate.py` | fail-closed approve/reject deployment gate |
152
+ | `flywheel.py` | ingest corrected captures with content + perceptual dedupe |
153
+ | `active_learning.py` | rank which frames to label next (novelty + domain gaps + uncertainty) |
154
+ | `run_registry.py` | append-only, hash-linked ledger of training/eval runs |
155
+ | `test_*.py` | geometry, window, depth and architecture regression tests |
156
+ | `kaggle/` | Kaggle training: notebook, dataset/kernel metadata, guarded push helper |
157
+
158
+ ## Evaluation & status
159
+
160
+ This preview ships the full pipeline and its tests; model accuracy numbers are
161
+ deliberately not claimed here and are produced by `train.py` against a
162
+ session-separated, real paint dataset. Reported training metrics include
163
+ per-class IoU, drywall precision/recall, **window precision/recall**, wall
164
+ boundary F1, bottom-edge error, painted-coverage error and uncertainty
165
+ fraction.
166
+
167
+ ## Intended use and limitations
168
+
169
+ **Intended:** assistive perception and path planning for painting/finishing
170
+ robots; dataset curation and annotation QA for construction vision.
171
+
172
+ **Not intended:** unattended safety-critical control without calibrated geometry,
173
+ clearance validation and a human-approved deployment; judging *finish quality*
174
+ (streaking, thin coat, runs) — that needs dedicated defect labels and reference
175
+ captures after the coat cures.
176
+
177
+ RGB alone cannot always reveal what is under a smooth surface; the model scores
178
+ drywall only where visible evidence supports it and uses `unknown` otherwise.
179
+ Always validate on held-out physical walls with the production camera.
180
+
181
+ ## Citation
182
+
183
+ ```bibtex
184
+ @misc{constructelligence_painting_vision,
185
+ title = {Painting Vision: robot-ready wall-paint coverage segmentation},
186
+ author = {Constructelligence},
187
+ year = {2026},
188
+ note = {Research preview}
189
+ }
190
+ ```
191
+
192
+ ## Keywords
193
+
194
+ wall painting robot · autonomous painting · paint coverage estimation ·
195
+ construction AI · building facade segmentation · drywall detection · skirting
196
+ detection · window detection · semantic segmentation · LiDAR validation ·
197
+ depth sensing · robot path planning · paint progress tracking · construction
198
+ robotics · BIM · surface finishing automation