DeepDataLab commited on
Commit
937e41b
·
verified ·
1 Parent(s): d30923c

Upload 2 files

Browse files
Files changed (2) hide show
  1. data.json +1 -0
  2. index.html +140 -19
data.json ADDED
@@ -0,0 +1 @@
 
 
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}]}
index.html CHANGED
@@ -1,19 +1,140 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Pre-label confidence explorer</title>
7
+ <style>
8
+ :root { --bg:#0a1628; --card:#10213a; --text:#e8eef6; --muted:#9fb0c6;
9
+ --teal:#14b8a6; --gold:#f5c542; }
10
+ * { box-sizing: border-box; }
11
+ body { margin:0; background:var(--bg); color:var(--text); line-height:1.5;
12
+ font-family: system-ui, -apple-system, "Segoe UI", sans-serif; }
13
+ main { max-width: 820px; margin: 0 auto; padding: 24px 16px 48px; }
14
+ h1 { font-size: 1.6rem; margin: 0 0 12px; }
15
+ p { color: var(--muted); margin: 10px 0; }
16
+ .card { background: var(--card); border-radius: 12px; padding: 16px 18px; margin: 16px 0; }
17
+ input[type=range] { width: 100%; accent-color: var(--teal); }
18
+ .row { display: flex; justify-content: space-between; align-items: baseline; }
19
+ .big { font-size: 1.1rem; font-weight: 600; }
20
+ ul { margin: 8px 0 0; padding-left: 20px; }
21
+ li { margin: 6px 0; }
22
+ .legend { display: flex; gap: 18px; flex-wrap: wrap; font-size: .9rem;
23
+ color: var(--muted); margin-top: 8px; }
24
+ .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%;
25
+ margin-right: 6px; }
26
+ .note { font-size: .85rem; font-style: italic; }
27
+ </style>
28
+ </head>
29
+ <body>
30
+ <main>
31
+ <h1>Pre-label confidence explorer</h1>
32
+ <p>YOLOv8n pre-labels on 8 frames of a busy night street video, compared with my own
33
+ from-scratch annotation of the same frames. Move the slider to see what happens if
34
+ only boxes above a confidence threshold are sent for review.</p>
35
+ <p><strong>Trade-off:</strong> a higher threshold means fewer boxes to check and a
36
+ higher share of kept boxes that I also drew, but more of my own boxes end up without
37
+ any model box. At the highest thresholds only a few boxes remain, so those values are
38
+ noisy.</p>
39
+ <p class="note">Small experiment: 8 frames, one annotator. A pattern, not proof.
40
+ Same place means IoU of at least 0.5, class may differ.</p>
41
+
42
+ <div class="card">
43
+ <div class="row">
44
+ <label for="t">Confidence threshold</label>
45
+ <span class="big" id="tval">0.70</span>
46
+ </div>
47
+ <input id="t" type="range" min="0.25" max="0.95" step="0.05" value="0.70">
48
+ <ul id="summary"></ul>
49
+ </div>
50
+
51
+ <div class="card">
52
+ <div id="chart"></div>
53
+ <div class="legend">
54
+ <span><span class="dot" style="background:var(--teal)"></span>share of kept boxes I also drew</span>
55
+ <span><span class="dot" style="background:var(--gold)"></span>share of my boxes covered</span>
56
+ </div>
57
+ </div>
58
+ </main>
59
+
60
+ <script>
61
+ const GRID = Array.from({length: 15}, (_, i) => Math.round((0.25 + 0.05 * i) * 100) / 100);
62
+ let data = null;
63
+
64
+ function stats(t) {
65
+ const kept = data.boxes.filter(b => b.conf >= t);
66
+ const agree = kept.reduce((s, b) => s + b.hit, 0);
67
+ return {
68
+ kept: kept.length,
69
+ agree: agree,
70
+ share: kept.length ? agree / kept.length : null,
71
+ coverage: agree / data.total_scratch
72
+ };
73
+ }
74
+
75
+ function pct(v) { return Math.round(v * 100) + "%"; }
76
+
77
+ function chart(t) {
78
+ const W = 700, H = 360, L = 48, R = 16, T = 14, B = 46;
79
+ const x = v => L + (v - 0.25) / 0.70 * (W - L - R);
80
+ const y = v => T + (1 - v) * (H - T - B);
81
+ let svg = `<svg viewBox="0 0 ${W} ${H}" width="100%" role="img"
82
+ aria-label="Share of kept boxes I also drew and share of my boxes covered, by threshold">`;
83
+ for (let i = 0; i <= 5; i++) {
84
+ const v = i / 5;
85
+ svg += `<line x1="${L}" x2="${W - R}" y1="${y(v)}" y2="${y(v)}" stroke="#25395a"/>
86
+ <text x="${L - 8}" y="${y(v) + 4}" text-anchor="end" fill="#9fb0c6" font-size="12">${v.toFixed(1)}</text>`;
87
+ }
88
+ GRID.forEach(g => {
89
+ if (Math.round(g * 100) % 10 === 0) {
90
+ svg += `<text x="${x(g)}" y="${H - B + 20}" text-anchor="middle" fill="#9fb0c6" font-size="12">${g.toFixed(1)}</text>`;
91
+ }
92
+ });
93
+ svg += `<text x="${(L + W - R) / 2}" y="${H - 6}" text-anchor="middle" fill="#9fb0c6" font-size="12">confidence threshold</text>`;
94
+
95
+ function line(key, color) {
96
+ let d = "", pen = false, dots = "";
97
+ GRID.forEach(g => {
98
+ const v = stats(g)[key];
99
+ if (v === null) { pen = false; return; }
100
+ d += (pen ? "L" : "M") + x(g).toFixed(1) + " " + y(v).toFixed(1) + " ";
101
+ pen = true;
102
+ dots += `<circle cx="${x(g).toFixed(1)}" cy="${y(v).toFixed(1)}" r="3.5" fill="${color}"/>`;
103
+ });
104
+ return `<path d="${d}" fill="none" stroke="${color}" stroke-width="2.5"/>` + dots;
105
+ }
106
+ svg += line("share", "#14b8a6") + line("coverage", "#f5c542");
107
+ svg += `<line x1="${x(t)}" x2="${x(t)}" y1="${T}" y2="${H - B}" stroke="#9fb0c6" stroke-dasharray="5 4"/>`;
108
+ return svg + "</svg>";
109
+ }
110
+
111
+ function render() {
112
+ const t = parseFloat(document.getElementById("t").value);
113
+ document.getElementById("tval").textContent = t.toFixed(2);
114
+ const s = stats(t);
115
+ const n = data.boxes.length;
116
+ let html;
117
+ if (s.kept === 0) {
118
+ html = "<li>No model boxes reach this threshold.</li>";
119
+ } else {
120
+ html = `<li>Model boxes kept for review: <strong>${s.kept} of ${n}</strong> (${pct(1 - s.kept / n)} fewer boxes to check)</li>
121
+ <li>Kept boxes where I also drew a box in the same place: <strong>${s.agree} of ${s.kept}</strong> (${pct(s.share)})</li>
122
+ <li>My from-scratch boxes covered by a kept model box: <strong>${s.agree} of ${data.total_scratch}</strong> (${pct(s.coverage)})</li>`;
123
+ }
124
+ document.getElementById("summary").innerHTML = html;
125
+ document.getElementById("chart").innerHTML = chart(t);
126
+ }
127
+
128
+ fetch("data.json")
129
+ .then(r => r.json())
130
+ .then(d => {
131
+ data = d;
132
+ document.getElementById("t").addEventListener("input", render);
133
+ render();
134
+ })
135
+ .catch(() => {
136
+ document.getElementById("summary").innerHTML = "<li>Could not load data.json</li>";
137
+ });
138
+ </script>
139
+ </body>
140
+ </html>