Download index.html from DeepDataLab/prelabel-confidence-explorer: direct link, hf CLI and curl.
- Browser
- Download file 5.76 kB
-
https://huggingface.co/spaces/DeepDataLab/prelabel-confidence-explorer/resolve/main/index.html
- Command line
-
hf download hf://spaces/DeepDataLab/prelabel-confidence-explorer/index.html
-
curl -L -o index.html https://huggingface.co/spaces/DeepDataLab/prelabel-confidence-explorer/resolve/main/index.html
5.76 kB
| <html lang="en"> | |
| <head> | |
| <meta charset="utf-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1"> | |
| <title>Pre-label confidence explorer</title> | |
| <style> | |
| :root { --bg:#0a1628; --card:#10213a; --text:#e8eef6; --muted:#9fb0c6; | |
| --teal:#14b8a6; --gold:#f5c542; } | |
| * { box-sizing: border-box; } | |
| body { margin:0; background:var(--bg); color:var(--text); line-height:1.5; | |
| font-family: system-ui, -apple-system, "Segoe UI", sans-serif; } | |
| main { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; } | |
| h1 { font-size: 1.6rem; margin: 0 0 12px; } | |
| p { color: var(--muted); margin: 10px 0; } | |
| .card { background: var(--card); border-radius: 12px; padding: 16px 18px; margin: 16px 0; } | |
| input[type=range] { width: 100%; accent-color: var(--teal); } | |
| .row { display: flex; justify-content: space-between; align-items: baseline; } | |
| .big { font-size: 1.1rem; font-weight: 600; } | |
| ul { margin: 8px 0 0; padding-left: 20px; } | |
| li { margin: 6px 0; } | |
| .legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .9rem; | |
| color: var(--muted); margin-top: 8px; } | |
| .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; | |
| margin-right: 6px; } | |
| .note { font-size: .85rem; font-style: italic; } | |
| </style> | |
| </head> | |
| <body> | |
| <main> | |
| <h1>Pre-label confidence explorer</h1> | |
| <p>YOLOv8n pre-labels on 8 frames of a busy night street video, compared with my own | |
| from-scratch annotation of the same frames. Move the slider to see what happens if | |
| only boxes above a confidence threshold are sent for review.</p> | |
| <p><strong>Trade-off:</strong> a higher threshold means fewer boxes to check and a | |
| higher share of kept boxes that I also drew, but more of my own boxes end up without | |
| any model box. At the highest thresholds only a few boxes remain, so those values are | |
| noisy.</p> | |
| <p class="note">Small experiment: 8 frames, one annotator. A pattern, not proof. | |
| Same place means IoU of at least 0.5, class may differ.</p> | |
| <div class="card"> | |
| <div class="row"> | |
| <label for="t">Confidence threshold</label> | |
| <span class="big" id="tval">0.70</span> | |
| </div> | |
| <input id="t" type="range" min="0.25" max="0.95" step="0.05" value="0.70"> | |
| <ul id="summary"></ul> | |
| </div> | |
| <div class="card"> | |
| <div id="chart"></div> | |
| <div class="legend"> | |
| <span><span class="dot" style="background:var(--teal)"></span>share of kept boxes I also drew</span> | |
| <span><span class="dot" style="background:var(--gold)"></span>share of my boxes covered</span> | |
| </div> | |
| </div> | |
| </main> | |
| <script> | |
| const GRID = Array.from({length: 15}, (_, i) => Math.round((0.25 + 0.05 * i) * 100) / 100); | |
| let data = null; | |
| function stats(t) { | |
| const kept = data.boxes.filter(b => b.conf >= t); | |
| const agree = kept.reduce((s, b) => s + b.hit, 0); | |
| return { | |
| kept: kept.length, | |
| agree: agree, | |
| share: kept.length ? agree / kept.length : null, | |
| coverage: agree / data.total_scratch | |
| }; | |
| } | |
| function pct(v) { return Math.round(v * 100) + "%"; } | |
| function chart(t) { | |
| const W = 700, H = 360, L = 48, R = 16, T = 14, B = 46; | |
| const x = v => L + (v - 0.25) / 0.70 * (W - L - R); | |
| const y = v => T + (1 - v) * (H - T - B); | |
| let svg = `<svg viewBox="0 0 ${W} ${H}" width="100%" role="img" | |
| aria-label="Share of kept boxes I also drew and share of my boxes covered, by threshold">`; | |
| for (let i = 0; i <= 5; i++) { | |
| const v = i / 5; | |
| svg += `<line x1="${L}" x2="${W - R}" y1="${y(v)}" y2="${y(v)}" stroke="#25395a"/> | |
| <text x="${L - 8}" y="${y(v) + 4}" text-anchor="end" fill="#9fb0c6" font-size="12">${v.toFixed(1)}</text>`; | |
| } | |
| GRID.forEach(g => { | |
| if (Math.round(g * 100) % 10 === 0) { | |
| svg += `<text x="${x(g)}" y="${H - B + 20}" text-anchor="middle" fill="#9fb0c6" font-size="12">${g.toFixed(1)}</text>`; | |
| } | |
| }); | |
| svg += `<text x="${(L + W - R) / 2}" y="${H - 6}" text-anchor="middle" fill="#9fb0c6" font-size="12">confidence threshold</text>`; | |
| function line(key, color) { | |
| let d = "", pen = false, dots = ""; | |
| GRID.forEach(g => { | |
| const v = stats(g)[key]; | |
| if (v === null) { pen = false; return; } | |
| d += (pen ? "L" : "M") + x(g).toFixed(1) + " " + y(v).toFixed(1) + " "; | |
| pen = true; | |
| dots += `<circle cx="${x(g).toFixed(1)}" cy="${y(v).toFixed(1)}" r="3.5" fill="${color}"/>`; | |
| }); | |
| return `<path d="${d}" fill="none" stroke="${color}" stroke-width="2.5"/>` + dots; | |
| } | |
| svg += line("share", "#14b8a6") + line("coverage", "#f5c542"); | |
| svg += `<line x1="${x(t)}" x2="${x(t)}" y1="${T}" y2="${H - B}" stroke="#9fb0c6" stroke-dasharray="5 4"/>`; | |
| return svg + "</svg>"; | |
| } | |
| function render() { | |
| const t = parseFloat(document.getElementById("t").value); | |
| document.getElementById("tval").textContent = t.toFixed(2); | |
| const s = stats(t); | |
| const n = data.boxes.length; | |
| let html; | |
| if (s.kept === 0) { | |
| html = "<li>No model boxes reach this threshold.</li>"; | |
| } else { | |
| html = `<li>Model boxes kept for review: <strong>${s.kept} of ${n}</strong> (${pct(1 - s.kept / n)} fewer boxes to check)</li> | |
| <li>Kept boxes where I also drew a box in the same place: <strong>${s.agree} of ${s.kept}</strong> (${pct(s.share)})</li> | |
| <li>My from-scratch boxes covered by a kept model box: <strong>${s.agree} of ${data.total_scratch}</strong> (${pct(s.coverage)})</li>`; | |
| } | |
| document.getElementById("summary").innerHTML = html; | |
| document.getElementById("chart").innerHTML = chart(t); | |
| } | |
| fetch("data.json") | |
| .then(r => r.json()) | |
| .then(d => { | |
| data = d; | |
| document.getElementById("t").addEventListener("input", render); | |
| render(); | |
| }) | |
| .catch(() => { | |
| document.getElementById("summary").innerHTML = "<li>Could not load data.json</li>"; | |
| }); | |
| </script> | |
| </body> | |
| </html> |