Upload 2 files
Browse filesFiles changed (2)
- data.jsonAdded+1
- index.html+140-19
1{"total_scratch": 53, "boxes": [{"label": "car", "conf": 0.883, "hit": 1}, {"label": "car", "conf": 0.851, "hit": 1}, {"label": "car", "conf": 0.849, "hit": 1}, {"label": "car", "conf": 0.819, "hit": 1}, {"label": "car", "conf": 0.767, "hit": 1}, {"label": "person", "conf": 0.704, "hit": 1}, {"label": "person", "conf": 0.678, "hit": 0}, {"label": "person", "conf": 0.628, "hit": 1}, {"label": "bus", "conf": 0.545, "hit": 0}, {"label": "car", "conf": 0.522, "hit": 0}, {"label": "person", "conf": 0.452, "hit": 1}, {"label": "truck", "conf": 0.291, "hit": 0}, {"label": "person", "conf": 0.261, "hit": 0}, {"label": "car", "conf": 0.895, "hit": 1}, {"label": "person", "conf": 0.892, "hit": 1}, {"label": "motorcycle", "conf": 0.753, "hit": 1}, {"label": "person", "conf": 0.74, "hit": 0}, {"label": "person", "conf": 0.74, "hit": 0}, {"label": "person", "conf": 0.659, "hit": 0}, {"label": "person", "conf": 0.637, "hit": 0}, {"label": "car", "conf": 0.584, "hit": 0}, {"label": "motorcycle", "conf": 0.573, "hit": 1}, {"label": "bus", "conf": 0.487, "hit": 0}, {"label": "car", "conf": 0.456, "hit": 0}, {"label": "car", "conf": 0.423, "hit": 0}, {"label": "person", "conf": 0.374, "hit": 0}, {"label": "car", "conf": 0.364, "hit": 0}, {"label": "car", "conf": 0.361, "hit": 0}, {"label": "person", "conf": 0.359, "hit": 1}, {"label": "car", "conf": 0.351, "hit": 0}, {"label": "person", "conf": 0.342, "hit": 0}, {"label": "person", "conf": 0.34, "hit": 0}, {"label": "person", "conf": 0.329, "hit": 1}, {"label": "car", "conf": 0.318, "hit": 0}, {"label": "motorcycle", "conf": 0.312, "hit": 0}, {"label": "motorcycle", "conf": 0.305, "hit": 0}, {"label": "truck", "conf": 0.304, "hit": 1}, {"label": "car", "conf": 0.268, "hit": 0}, {"label": "car", "conf": 0.25, "hit": 0}, {"label": "car", "conf": 0.921, "hit": 1}, {"label": "car", "conf": 0.902, "hit": 1}, {"label": "person", "conf": 0.898, "hit": 1}, {"label": "car", "conf": 0.886, "hit": 1}, {"label": "person", "conf": 0.825, "hit": 0}, {"label": "motorcycle", "conf": 0.717, "hit": 1}, {"label": "bus", "conf": 0.63, "hit": 1}, {"label": "person", "conf": 0.539, "hit": 0}, {"label": "car", "conf": 0.506, "hit": 0}, {"label": "person", "conf": 0.497, "hit": 1}, {"label": "car", "conf": 0.408, "hit": 0}, {"label": "car", "conf": 0.37, "hit": 0}, {"label": "person", "conf": 0.316, "hit": 0}, {"label": "car", "conf": 0.301, "hit": 0}, {"label": "car", "conf": 0.284, "hit": 0}, {"label": "person", "conf": 0.272, "hit": 0}, {"label": "person", "conf": 0.256, "hit": 0}, {"label": "bus", "conf": 0.932, "hit": 1}, {"label": "person", "conf": 0.895, "hit": 1}, {"label": "car", "conf": 0.893, "hit": 1}, {"label": "car", "conf": 0.873, "hit": 1}, {"label": "person", "conf": 0.853, "hit": 1}, {"label": "car", "conf": 0.742, "hit": 1}, {"label": "person", "conf": 0.62, "hit": 0}, {"label": "person", "conf": 0.608, "hit": 1}, {"label": "person", "conf": 0.551, "hit": 0}, {"label": "person", "conf": 0.369, "hit": 0}, {"label": "person", "conf": 0.362, "hit": 0}, {"label": "car", "conf": 0.346, "hit": 0}, {"label": "person", "conf": 0.276, "hit": 0}, {"label": "bus", "conf": 0.902, "hit": 1}, {"label": "car", "conf": 0.888, "hit": 1}, {"label": "person", "conf": 0.867, "hit": 1}, {"label": "person", "conf": 0.834, "hit": 1}, {"label": "person", "conf": 0.666, "hit": 0}, {"label": "person", "conf": 0.548, "hit": 0}, {"label": "person", "conf": 0.431, "hit": 1}, {"label": "person", "conf": 0.322, "hit": 0}, {"label": "person", "conf": 0.293, "hit": 0}, {"label": "person", "conf": 0.885, "hit": 1}, {"label": "bus", "conf": 0.844, "hit": 1}, {"label": "person", "conf": 0.605, "hit": 0}, {"label": "person", "conf": 0.547, "hit": 1}, {"label": "person", "conf": 0.473, "hit": 0}, {"label": "person", "conf": 0.469, "hit": 0}, {"label": "person", "conf": 0.392, "hit": 0}, {"label": "person", "conf": 0.333, "hit": 0}, {"label": "person", "conf": 0.315, "hit": 0}, {"label": "person", "conf": 0.291, "hit": 0}, {"label": "car", "conf": 0.937, "hit": 1}, {"label": "car", "conf": 0.891, "hit": 1}, {"label": "person", "conf": 0.873, "hit": 1}, {"label": "car", "conf": 0.823, "hit": 1}, {"label": "person", "conf": 0.735, "hit": 1}, {"label": "car", "conf": 0.663, "hit": 0}, {"label": "car", "conf": 0.54, "hit": 0}, {"label": "car", "conf": 0.5, "hit": 0}, {"label": "person", "conf": 0.499, "hit": 0}, {"label": "person", "conf": 0.439, "hit": 0}, {"label": "person", "conf": 0.3, "hit": 0}, {"label": "car", "conf": 0.266, "hit": 0}, {"label": "car", "conf": 0.256, "hit": 0}, {"label": "car", "conf": 0.932, "hit": 1}, {"label": "car", "conf": 0.925, "hit": 1}, {"label": "car", "conf": 0.886, "hit": 1}, {"label": "person", "conf": 0.881, "hit": 1}, {"label": "person", "conf": 0.743, "hit": 0}, {"label": "car", "conf": 0.709, "hit": 0}, {"label": "car", "conf": 0.652, "hit": 0}, {"label": "person", "conf": 0.604, "hit": 0}, {"label": "car", "conf": 0.521, "hit": 0}, {"label": "car", "conf": 0.494, "hit": 0}, {"label": "car", "conf": 0.371, "hit": 0}, {"label": "car", "conf": 0.358, "hit": 1}, {"label": "person", "conf": 0.341, "hit": 1}, {"label": "car", "conf": 0.309, "hit": 0}]}12345678910111213141516171819123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140<!doctype html><html> <head> <meta charset="utf-8" /> <meta name="viewport" content="width=device-width" /> <title>My static Space</title> <link rel="stylesheet" href="style.css" /> </head> <body> <div class="card"> <h1>Welcome to your static Space!</h1> <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p> <p> Also don't forget to check the <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>. </p> </div> </body></html><!DOCTYPE html><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>data.jsonAdded+1
index.html+140-19