Image Segmentation
PyTorch
English
painting-vision-robotics-kit
semantic-segmentation
robotics
edge-ai
construction-ai
autonomous-painting
wall-painting-robot
paint-coverage-estimation
building-facade
drywall
skirting-detection
window-detection
lidar
depth-validation
segformer
deeplabv3
Eval Results (legacy)
Update code: real-machine G-code adapter, commissioning gate, machine_job runner, pump watchdog firmware, twin completion gate, realism and masking modules (card and weights unchanged)
4eecd03 verified Download console/floor.js from constructelligence/painting-vision-robotics-kit: direct link, hf CLI and curl.
- Browser
- Download file 4.24 kB
-
https://huggingface.co/constructelligence/painting-vision-robotics-kit/resolve/main/console/floor.js
- Command line
-
hf download hf://constructelligence/painting-vision-robotics-kit/console/floor.js
-
curl -L -o floor.js https://huggingface.co/constructelligence/painting-vision-robotics-kit/resolve/main/console/floor.js
4.24 kB
| // Floor overlay (off by default). The floor and the wall/floor line are computed on the server the first time the layer is | |
| // switched on for a job (floor_detect.py: general ADE20K floor model, made consistent with the wall model), then cached. | |
| ; | |
| (() => { | |
| const $ = (sel) => document.querySelector(sel); | |
| const toggles = $("#layer-toggles"), stage = $("#stage"); | |
| if (!toggles || !stage) return; | |
| const st = { jobId: null, loaded: false, loading: false, info: null }; | |
| const chip = document.createElement("label"); | |
| chip.className = "chip"; | |
| chip.innerHTML = `<input type="checkbox" data-layer="floor"><i class="sw sw-floor"></i>Floor`; | |
| toggles.appendChild(chip); | |
| const box = chip.querySelector("input"); | |
| const mk = (cls) => { const i = document.createElement("img"); i.className = cls; i.alt = ""; i.dataset.layer = "floor"; return i; }; | |
| const fill = mk("layer off"), edge = mk("layer edge off"); | |
| const anchor = document.querySelector('img.layer[data-layer="paint"]:not(.edge)') || $("#photo"); | |
| anchor.after(fill); | |
| fill.after(edge); | |
| const NS = "http://www.w3.org/2000/svg"; | |
| const line = document.createElementNS(NS, "svg"); | |
| line.setAttribute("class", "layer floor-line"); | |
| line.dataset.layer = "floor"; | |
| line.setAttribute("preserveAspectRatio", "none"); | |
| fill.parentNode.insertBefore(line, $("#vector") || null); | |
| const note = document.createElement("div"); | |
| note.className = "floor-note small muted"; | |
| note.hidden = true; | |
| const legend = $("#legend"); | |
| if (legend) legend.after(note); else stage.after(note); | |
| function sync() { if (typeof applyLayerToggles === "function") applyLayerToggles(); } | |
| function drawLine(info) { | |
| line.replaceChildren(); | |
| line.setAttribute("viewBox", `0 0 ${info.width} ${info.height}`); | |
| const fit = info.line && info.line.fit; | |
| if (!fit) return; | |
| const mk2 = (name, attrs) => { const e = document.createElementNS(NS, name); for (const [k, v] of Object.entries(attrs)) e.setAttribute(k, v); return e; }; | |
| line.appendChild(mk2("line", { x1: 0, y1: fit.y_at_left, x2: info.width, y2: fit.y_at_right, class: "fl-halo" })); | |
| line.appendChild(mk2("line", { x1: 0, y1: fit.y_at_left, x2: info.width, y2: fit.y_at_right, class: "fl-line" })); | |
| } | |
| function describe(info) { | |
| if (!info.found) return "No floor found in this photo (it may not be in frame)."; | |
| const pct = Math.round(info.share_of_image * 100); | |
| const fit = info.line && info.line.fit; | |
| if (!fit) return `Floor covers ${pct}% of the photo. The wall/floor edge is not a clean straight line here (furniture, a corner, or a curved edge).`; | |
| const a = fit.angle_deg, tilt = Math.abs(a); | |
| return `Floor covers ${pct}% of the photo. Wall/floor line ${tilt < 0.8 ? "is level" : `is tilted ${tilt.toFixed(1)}°`} (±${fit.rms_px} px). General-purpose model, checked by eye: correct it with the Fix-detection tools if it is wrong.`; | |
| } | |
| async function ensure() { | |
| if (!job || st.loading) return; | |
| if (st.loaded && st.jobId === job.id) return; | |
| st.loading = true; | |
| note.hidden = false; | |
| note.textContent = "Finding the floor… (first time per job takes a few seconds)"; | |
| try { | |
| const r = await fetch(`/api/jobs/${job.id}/floor`); | |
| const info = await r.json(); | |
| if (!r.ok) throw new Error(info.error || r.statusText); | |
| const v = `?v=${info.zones_stamp}-${info.seconds}`; | |
| fill.src = `/api/jobs/${job.id}/layer_floor.png${v}`; | |
| edge.src = `/api/jobs/${job.id}/layer_floor_edge.png${v}`; | |
| st.info = info; st.jobId = job.id; st.loaded = true; | |
| drawLine(info); | |
| note.textContent = describe(info); | |
| } catch (e) { | |
| note.textContent = `Floor detection is unavailable: ${e.message}`; | |
| } finally { st.loading = false; sync(); } | |
| } | |
| box.addEventListener("change", () => { | |
| note.hidden = !box.checked; | |
| sync(); | |
| if (box.checked) ensure(); | |
| }); | |
| const prev = showJob; | |
| showJob = function (j) { | |
| prev(j); | |
| st.loaded = false; st.info = null; | |
| fill.removeAttribute("src"); edge.removeAttribute("src"); line.replaceChildren(); | |
| note.hidden = !box.checked; | |
| if (box.checked) ensure(); else sync(); | |
| }; | |
| window.BuildPaintFloor = { get info() { return st.info; } }; | |
| })(); | |