-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathradar_budgets.html
More file actions
433 lines (389 loc) · 12.3 KB
/
radar_budgets.html
File metadata and controls
433 lines (389 loc) · 12.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>A-OKVQA Category-wise Performance — Pixel Budgets</title>
<link href="https://fonts.googleapis.com/css2?family=DM+Mono:wght@400;500&family=Outfit:wght@300;400;600;700&display=swap" rel="stylesheet">
<style>
:root {
--bg: #f0f2f8;
--surface: #ffffff;
--border: #e0e4f0;
--text: #1a1d27;
--muted: #8890aa;
--c-full: #7eb87e;
--c-llmind: #f07050;
--c-uniform: #888077;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body {
background: var(--bg);
color: var(--text);
font-family: 'Outfit', sans-serif;
padding: 44px 28px 60px;
min-height: 100vh;
}
header { text-align: center; margin-bottom: 10px; }
header h1 {
font-size: 1.45rem;
font-weight: 700;
letter-spacing: -0.01em;
color: var(--text);
}
header p {
font-size: 0.82rem;
color: var(--muted);
font-family: 'DM Mono', monospace;
margin-top: 5px;
margin-bottom: 26px;
}
/* Top legend */
.legend {
display: flex;
gap: 28px;
justify-content: center;
margin-bottom: 36px;
flex-wrap: wrap;
}
.legend-item {
display: flex;
align-items: center;
gap: 8px;
font-size: 0.82rem;
color: var(--text);
font-weight: 500;
cursor: pointer;
padding: 6px 14px;
border-radius: 99px;
border: 1.5px solid var(--border);
background: var(--surface);
transition: box-shadow 0.15s, border-color 0.15s;
user-select: none;
}
.legend-item:hover { box-shadow: 0 2px 12px rgba(0,0,0,0.08); }
.legend-item.active { border-color: currentColor; }
.legend-dot {
width: 11px; height: 11px;
border-radius: 50%;
flex-shrink: 0;
}
/* Charts row */
.charts-row {
display: flex;
flex-wrap: wrap;
gap: 28px;
justify-content: center;
}
.chart-card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: 18px;
padding: 28px 22px 20px;
box-shadow: 0 2px 20px rgba(0,0,0,0.055);
display: flex;
flex-direction: column;
align-items: center;
transition: box-shadow 0.2s;
}
.chart-card:hover { box-shadow: 0 6px 32px rgba(0,0,0,0.10); }
.card-label {
font-size: 0.95rem;
font-weight: 700;
color: var(--text);
margin-bottom: 16px;
letter-spacing: 0.01em;
}
.card-sub {
font-size: 0.72rem;
font-family: 'DM Mono', monospace;
color: var(--muted);
margin-top: -10px;
margin-bottom: 14px;
}
canvas { display: block; cursor: crosshair; }
/* Tooltip */
.tooltip {
position: fixed;
background: #1a1d27;
color: #f0f2f8;
padding: 9px 13px;
border-radius: 9px;
font-size: 0.73rem;
font-family: 'DM Mono', monospace;
pointer-events: none;
opacity: 0;
transition: opacity 0.12s;
z-index: 200;
line-height: 1.7;
white-space: nowrap;
box-shadow: 0 4px 20px rgba(0,0,0,0.18);
}
</style>
</head>
<body>
<header>
<h1>A-OKVQA — Category-wise Performance</h1>
<p>Qwen2.5-VL (4B) · Hover dots for values · Click legend to highlight</p>
</header>
<!-- Legend -->
<div class="legend" id="legend">
<div class="legend-item active" data-idx="0" style="color:#f07050">
<div class="legend-dot" style="background:#f07050"></div>LLMind (Ours)
</div>
<div class="legend-item active" data-idx="1" style="color:#888077">
<div class="legend-dot" style="background:#888077"></div>Uniform Sampled
</div>
</div>
<div class="charts-row" id="chartsRow"></div>
<div class="tooltip" id="tooltip"></div>
<script>
// ── DATA ─────────────────────────────────────────────────────────────────
// Categories clockwise from top
const categories = [
"Spatial\nRelations",
"Instance\nLocation",
"Instance\nCounting",
"Others",
"Yes/No\nVerification",
"Existence\nPresence",
"Instance\nInteraction",
"Instance\nAttributes",
];
const SERIES = [
{ label: "LLMind (Ours)", color: "#f07050" },
{ label: "Uniform Sampled", color: "#888077" },
];
// Values: [LLMind (Ours), Uniform Sampled]
// Order: Spatial Relations, Instance Location, Instance Counting, Others,
// Yes/No Verification, Existence Presence, Instance Interaction, Instance Attributes
const budgets = [
{
title: "1% Pixel Budget",
values: [
// LLMind (Ours)
[35.05, 29.19, 35.70, 35.05, 81.32, 72.94, 37.43, 56.72],
// Uniform Sampled
[29.89, 22.98, 32.67, 28.65, 75.47, 63.82, 27.39, 43.48],
],
},
{
title: "3% Pixel Budget",
values: [
// LLMind (Ours)
[43.29, 43.47, 57.59, 44.83, 85.91, 79.63, 52.23, 69.21],
// Uniform Sampled
[29.89, 27.95, 42.57, 32.71, 78.34, 71.12, 34.07, 52.96],
],
},
{
title: "5% Pixel Budget",
values: [
// LLMind (Ours)
[56.70, 56.52, 68.96, 53.93, 89.98, 88.15, 68.44, 78.69],
// Uniform Sampled
[34.02, 34.16, 49.01, 38.22, 81.09, 77.81, 44.97, 62.11],
],
},
];
// ── SETTINGS ─────────────────────────────────────────────────────────────
const N = categories.length;
const SIZE = 400;
const CX = SIZE / 2;
const CY = SIZE / 2;
const R = 148;
const MIN_V = 0;
// MAX_V computed per-budget below
// GRID computed per-budget below
// Compute per-budget maxV and grid rings (nearest 10 above all values)
budgets.forEach(b => {
const rawMax = Math.max(...b.values.flat());
b.maxV = Math.ceil(rawMax / 10) * 10;
const step = b.maxV / 5;
b.grid = Array.from({length: 5}, (_, i) => Math.round(step * (i + 1)));
});
// Visibility state per series index
const visible = [true, true];
function valToR(v, maxV) {
return (v / maxV) * R;
}
function toXY(angleRad, radius) {
return {
x: CX + radius * Math.sin(angleRad),
y: CY - radius * Math.cos(angleRad),
};
}
function hexToRgb(hex) {
const r = parseInt(hex.slice(1,3),16);
const g = parseInt(hex.slice(3,5),16);
const b = parseInt(hex.slice(5,7),16);
return `${r},${g},${b}`;
}
// ── DRAW ─────────────────────────────────────────────────────────────────
function drawRadar(canvas, budget, highlightSeries) {
const ctx = canvas.getContext("2d");
ctx.clearRect(0, 0, SIZE, SIZE);
const angles = Array.from({length: N}, (_, i) => (2 * Math.PI * i) / N);
// Grid polygons
budget.grid.forEach(val => {
const r = valToR(val, budget.maxV);
ctx.beginPath();
angles.forEach((a, i) => {
const p = toXY(a, r);
i === 0 ? ctx.moveTo(p.x, p.y) : ctx.lineTo(p.x, p.y);
});
ctx.closePath();
ctx.strokeStyle = "#dde2f0";
ctx.lineWidth = 1;
ctx.stroke();
// Grid value label
ctx.fillStyle = "#b8bdd0";
ctx.font = "9px DM Mono, monospace";
ctx.textAlign = "left";
ctx.fillText(val, CX + 4, CY - r + 3);
});
// Axis spokes
angles.forEach(a => {
const outer = toXY(a, R);
ctx.beginPath();
ctx.moveTo(CX, CY);
ctx.lineTo(outer.x, outer.y);
ctx.strokeStyle = "#dde2f0";
ctx.lineWidth = 1;
ctx.stroke();
});
// Draw each series (reverse so index-0 is on top)
[...SERIES].reverse().forEach((s, ri) => {
const di = SERIES.length - 1 - ri;
if (!visible[di]) return;
const isHigh = highlightSeries === null || highlightSeries === di;
const alpha = isHigh ? 1 : 0.15;
const fillA = isHigh ? 0.18 : 0.04;
const pts = budget.values[di].map((v, i) => toXY(angles[i], valToR(v, budget.maxV)));
// Fill
ctx.beginPath();
pts.forEach((p, i) => i === 0 ? ctx.moveTo(p.x, p.y) : ctx.lineTo(p.x, p.y));
ctx.closePath();
ctx.fillStyle = `rgba(${hexToRgb(s.color)},${fillA})`;
ctx.fill();
// Stroke
ctx.beginPath();
pts.forEach((p, i) => i === 0 ? ctx.moveTo(p.x, p.y) : ctx.lineTo(p.x, p.y));
ctx.closePath();
ctx.strokeStyle = `rgba(${hexToRgb(s.color)},${alpha})`;
ctx.lineWidth = 2;
ctx.stroke();
// Dots + value labels
pts.forEach((p, ci) => {
// Dot
ctx.beginPath();
ctx.arc(p.x, p.y, 4.5, 0, Math.PI * 2);
ctx.fillStyle = `rgba(${hexToRgb(s.color)},${alpha})`;
ctx.fill();
ctx.strokeStyle = `rgba(255,255,255,${alpha})`;
ctx.lineWidth = 1.5;
ctx.stroke();
// Value label
if (isHigh) {
const val = budget.values[di][ci];
const labelR = valToR(val, budget.maxV) + 12;
const lp = toXY(angles[ci], labelR);
ctx.fillStyle = `rgba(${hexToRgb(s.color)},0.9)`;
ctx.font = "bold 8.5px DM Mono, monospace";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
ctx.fillText(val.toFixed(2), lp.x, lp.y);
}
});
});
// Category labels
categories.forEach((cat, i) => {
const a = angles[i];
const lp = toXY(a, R + 28);
ctx.fillStyle = "#4a5068";
ctx.font = "600 10.5px Outfit, sans-serif";
ctx.textAlign = "center";
ctx.textBaseline = "middle";
const lines = cat.split("\n");
lines.forEach((line, li) => {
const offset = (li - (lines.length - 1) / 2) * 13;
ctx.fillText(line, lp.x, lp.y + offset);
});
});
}
// ── BUILD UI ──────────────────────────────────────────────────────────────
const row = document.getElementById("chartsRow");
const tooltip = document.getElementById("tooltip");
const canvases = [];
budgets.forEach((budget, bi) => {
const card = document.createElement("div");
card.className = "chart-card";
const label = document.createElement("div");
label.className = "card-label";
label.textContent = budget.title;
card.appendChild(label);
const canvas = document.createElement("canvas");
canvas.width = SIZE;
canvas.height = SIZE;
canvas.style.width = "380px";
canvas.style.height = "380px";
card.appendChild(canvas);
canvases.push(canvas);
row.appendChild(card);
let hoveredSeries = null;
function redraw() {
drawRadar(canvas, budget, hoveredSeries);
}
redraw();
// Mouse move — find nearest dot
canvas.addEventListener("mousemove", e => {
const rect = canvas.getBoundingClientRect();
const sx = SIZE / rect.width;
const sy = SIZE / rect.height;
const mx = (e.clientX - rect.left) * sx;
const my = (e.clientY - rect.top) * sy;
const angles = Array.from({length: N}, (_, i) => (2 * Math.PI * i) / N);
let bestDist = 999, bestSeries = null, bestCat = null, bestVal = null;
SERIES.forEach((s, si) => {
if (!visible[si]) return;
budget.values[si].forEach((v, ci) => {
const p = toXY(angles[ci], valToR(v, budget.maxV));
const d = Math.hypot(mx - p.x, my - p.y);
if (d < bestDist) {
bestDist = d; bestSeries = si;
bestCat = categories[ci].replace("\n"," ");
bestVal = v;
}
});
});
if (bestDist < 18) {
tooltip.style.opacity = "1";
tooltip.style.left = (e.clientX + 16) + "px";
tooltip.style.top = (e.clientY - 12) + "px";
tooltip.innerHTML = `<b style="color:${SERIES[bestSeries].color}">${SERIES[bestSeries].label}</b><br>${bestCat}: <b>${bestVal.toFixed(2)}%</b>`;
if (hoveredSeries !== bestSeries) { hoveredSeries = bestSeries; redraw(); }
} else {
tooltip.style.opacity = "0";
if (hoveredSeries !== null) { hoveredSeries = null; redraw(); }
}
});
canvas.addEventListener("mouseleave", () => {
tooltip.style.opacity = "0";
hoveredSeries = null;
redraw();
});
// Store redraw fn on card for legend use
card._redraw = redraw;
});
// ── LEGEND TOGGLE ─────────────────────────────────────────────────────────
document.querySelectorAll(".legend-item").forEach(item => {
const idx = parseInt(item.dataset.idx);
item.addEventListener("click", () => {
visible[idx] = !visible[idx];
item.style.opacity = visible[idx] ? "1" : "0.35";
canvases.forEach((c, bi) => budgets[bi] && drawRadar(c, budgets[bi], null));
});
});
</script>
</body>
</html>