-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
713 lines (633 loc) · 23 KB
/
index.html
File metadata and controls
713 lines (633 loc) · 23 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
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>COCO Caption Classification | Results</title>
<!-- Include FontAwesome for icons -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
<!-- Google Fonts -->
<link
href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@300;400;500;600&family=Space+Grotesk:wght@400;500;600;700&display=swap"
rel="stylesheet">
<style>
:root {
--bg: #f6f1e8;
--panel: #fffdf8;
--ink: #1b1b1f;
--muted: #5f6470;
--accent: #1f6f8b;
--accent-strong: #14546a;
--accent-2: #d67b2f;
--accent-2-strong: #b9601f;
--border: rgba(27, 27, 31, 0.12);
--shadow: 0 20px 55px rgba(18, 26, 40, 0.12);
}
* {
box-sizing: border-box;
}
body {
font-family: "IBM Plex Sans", "Space Grotesk", sans-serif;
background: radial-gradient(circle at 15% 5%, rgba(214, 123, 47, 0.16), transparent 52%),
radial-gradient(circle at 85% 10%, rgba(31, 111, 139, 0.18), transparent 45%),
linear-gradient(180deg, #f6f1e8 0%, #f3f6f0 55%, #f8efe6 100%);
color: var(--ink);
margin: 0;
min-height: 100vh;
}
a {
color: inherit;
text-decoration: none;
}
.wrap {
max-width: 1100px;
margin: 0 auto;
padding: 48px 24px 80px;
}
.panel {
background: var(--panel);
border: 1px solid var(--border);
border-radius: 24px;
padding: 32px;
box-shadow: var(--shadow);
margin-bottom: 32px;
position: relative;
overflow: hidden;
animation: rise 0.7s ease both;
}
.panel:nth-of-type(2) {
animation-delay: 0.08s;
}
.panel:nth-of-type(3) {
animation-delay: 0.16s;
}
.panel:nth-of-type(4) {
animation-delay: 0.24s;
}
.panel:nth-of-type(5) {
animation-delay: 0.32s;
}
.panel:nth-of-type(6) {
animation-delay: 0.4s;
}
.panel:nth-of-type(7) {
animation-delay: 0.48s;
}
@keyframes rise {
from {
opacity: 0;
transform: translateY(18px);
}
to {
opacity: 1;
transform: translateY(0);
}
}
@media (prefers-reduced-motion: reduce) {
.panel {
animation: none;
}
}
.hero {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 28px;
align-items: stretch;
}
.eyebrow {
text-transform: uppercase;
letter-spacing: 0.24em;
font-weight: 600;
font-size: 0.72rem;
color: var(--accent);
margin: 0 0 12px;
}
h1,
h2,
h3 {
font-family: "Space Grotesk", sans-serif;
margin: 0 0 12px;
}
h1 {
font-size: clamp(2.2rem, 3vw, 3rem);
color: var(--ink);
}
h2 {
font-size: 1.6rem;
}
h3 {
font-size: 1.1rem;
text-transform: uppercase;
letter-spacing: 0.12em;
color: var(--muted);
}
p {
margin: 0 0 14px;
color: var(--muted);
line-height: 1.7;
}
.lede {
font-size: 1.05rem;
color: #2f3340;
}
.pill-row {
display: flex;
flex-wrap: wrap;
gap: 10px;
margin-top: 18px;
}
.pill {
border: 1px solid rgba(31, 111, 139, 0.2);
background: rgba(31, 111, 139, 0.08);
color: #10455b;
padding: 6px 12px;
border-radius: 999px;
font-size: 0.85rem;
font-weight: 500;
}
.hero-card {
background: linear-gradient(160deg, rgba(31, 111, 139, 0.08), rgba(214, 123, 47, 0.12));
border-radius: 20px;
padding: 24px;
border: 1px solid rgba(31, 111, 139, 0.2);
display: flex;
flex-direction: column;
justify-content: space-between;
gap: 18px;
}
.metric-stack {
display: grid;
gap: 14px;
}
.metric {
display: grid;
gap: 4px;
}
.metric-label {
font-size: 0.85rem;
color: var(--muted);
text-transform: uppercase;
letter-spacing: 0.12em;
}
.metric-value {
font-size: 1.8rem;
font-weight: 700;
color: var(--ink);
}
.metric-note {
font-size: 0.9rem;
color: var(--muted);
}
.cta-row {
display: flex;
flex-wrap: wrap;
gap: 12px;
}
.button {
display: inline-flex;
align-items: center;
gap: 8px;
padding: 10px 16px;
border-radius: 999px;
font-weight: 600;
font-size: 0.9rem;
background: var(--accent);
color: #fff;
transition: transform 0.2s ease, box-shadow 0.2s ease;
box-shadow: 0 12px 24px rgba(31, 111, 139, 0.2);
}
.button.secondary {
background: var(--accent-2);
box-shadow: 0 12px 24px rgba(214, 123, 47, 0.2);
}
.button.ghost {
background: transparent;
color: var(--accent-strong);
border: 1px solid rgba(31, 111, 139, 0.3);
box-shadow: none;
}
.button:hover {
transform: translateY(-2px);
box-shadow: 0 18px 28px rgba(31, 111, 139, 0.26);
}
.button.secondary:hover {
box-shadow: 0 18px 28px rgba(214, 123, 47, 0.26);
}
.stat-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
gap: 16px;
margin-top: 20px;
}
.stat-card {
border: 1px solid var(--border);
border-radius: 16px;
padding: 18px;
background: #fff;
display: grid;
gap: 8px;
}
.stat-card span {
font-size: 0.85rem;
color: var(--muted);
text-transform: uppercase;
letter-spacing: 0.1em;
}
.stat-card strong {
font-size: 1.4rem;
color: var(--ink);
}
.stat-card p {
font-size: 0.9rem;
margin: 0;
}
.config-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 16px;
margin-top: 20px;
}
.config-card {
border: 1px solid var(--border);
border-radius: 16px;
padding: 18px;
background: #fff;
display: grid;
gap: 10px;
}
.config-card h3 {
margin-bottom: 4px;
}
.config-card ul {
margin: 0;
padding-left: 18px;
}
.performance-table {
width: 100%;
border-collapse: collapse;
margin-top: 20px;
font-size: 0.95rem;
background: #fff;
border-radius: 16px;
overflow: hidden;
}
.performance-table th,
.performance-table td {
padding: 14px 16px;
border-bottom: 1px solid var(--border);
text-align: left;
}
.performance-table th {
background: rgba(31, 111, 139, 0.08);
color: var(--ink);
}
.performance-table tr:last-child td {
border-bottom: none;
}
.chart-grid {
display: grid;
gap: 18px;
}
.image-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
gap: 18px;
}
.image-grid.grid-2 {
grid-template-columns: repeat(2, minmax(0, 1fr));
}
.image-stack {
display: grid;
gap: 18px;
}
.image-block {
display: grid;
gap: 10px;
}
img {
width: 100%;
height: auto;
border-radius: 16px;
border: 1px solid var(--border);
box-shadow: 0 12px 24px rgba(18, 26, 40, 0.08);
}
ul {
margin: 0;
padding-left: 18px;
color: var(--muted);
}
li {
margin-bottom: 10px;
}
code {
font-family: "IBM Plex Mono", monospace;
font-size: 0.88rem;
background: rgba(31, 111, 139, 0.08);
color: #0f465b;
padding: 2px 6px;
border-radius: 6px;
}
footer {
text-align: center;
color: var(--muted);
font-size: 0.9rem;
margin-top: 36px;
}
@media (max-width: 900px) {
.hero {
grid-template-columns: 1fr;
}
}
@media (max-width: 640px) {
.wrap {
padding: 32px 16px 60px;
}
.panel {
padding: 24px;
}
.button {
width: 100%;
justify-content: center;
}
.image-grid.grid-2 {
grid-template-columns: 1fr;
}
}
</style>
</head>
<body>
<main class="wrap">
<header class="panel hero">
<div>
<p class="eyebrow">COCO Caption Classification</p>
<h1>Results dashboard for caption matching with CLIP</h1>
<p class="lede">Zero-shot and few-shot performance on a curated COCO subset with 12-caption candidate
sets. The model selects the single correct caption against 11 distractors.</p>
<div class="pill-row">
<span class="pill">Best zero-shot accuracy: 90.17% (RN50)</span>
<span class="pill">Best few-shot accuracy: 90.00% (ViT-B/32, 8-shot)</span>
<span class="pill">Eval set: 11,640 samples</span>
<span class="pill">Trainable params: 65,536 to 262,144</span>
</div>
</div>
<div class="hero-card">
<div class="metric-stack">
<div class="metric">
<span class="metric-label">Best Zero-shot F1</span>
<span class="metric-value">90.16%</span>
<span class="metric-note">RN50 backbone</span>
</div>
<div class="metric">
<span class="metric-label">Few-shot F1</span>
<span class="metric-value">90.00%</span>
<span class="metric-note">ViT-B/32 with residual adapters</span>
</div>
</div>
<div>
<h3>Release artifacts</h3>
<ul>
<li><code>models/best_rn50_8shot.pth</code></li>
<li><code>models/best_vit_b32_8shot.pth</code></li>
<li><code>docs/plot/*.json</code> Plotly curves</li>
</ul>
</div>
<div class="cta-row">
<a class="button" href="https://github.com/ThaiLearnCoding/Coco_caption_classification"
target="_blank">
<i class="fab fa-github"></i> Source Code
</a>
<a class="button secondary" href="https://huggingface.co/spaces/ThaiLearnCoding/Coco_caption_classification"
target="_blank">
<i class="fas fa-rocket"></i> Streamlit Demo
</a>
<a class="button ghost" href="#"><i class="fab fa-youtube"></i> Video Report</a>
</div>
</div>
</header>
<section class="panel">
<h2>Dataset processing</h2>
<p>Curated COCO subset for caption matching with strict train and evaluation separation.</p>
<ul>
<li><strong>Source:</strong> COCO subset metadata at
<code>coco_subset_images/coco_multimodal_subset.json</code>.
</li>
<li><strong>Input:</strong> 1 image + 12 candidate captions (1 correct, 11 distractors).</li>
<li><strong>Splits:</strong> k-shot removal for <code>k={0, 8}</code> preserves test integrity.</li>
<li><strong>Normalization:</strong> CLIP-specific mean and std per backbone.</li>
</ul>
</section>
<section class="panel">
<h2>Model configuration</h2>
<p>Reference settings used for training and evaluation discussions.</p>
<div class="config-grid">
<div class="config-card">
<h3>Dataset</h3>
<ul>
<li><strong>Subset dir:</strong> <code>coco_subset_images</code></li>
<li><strong>Images:</strong> <code>coco_subset_images/images</code></li>
<li><strong>Metadata:</strong> <code>coco_multimodal_subset.json</code></li>
<li><strong>Distractors:</strong> 11 (N=12 total captions)</li>
</ul>
</div>
<div class="config-card">
<h3>Training</h3>
<ul>
<li><strong>Epochs:</strong> 25</li>
<li><strong>Batch size:</strong> 32</li>
<li><strong>Learning rate:</strong> 3e-4</li>
<li><strong>Weight decay:</strong> 0.01</li>
<li><strong>Label smoothing:</strong> 0.2</li>
<li><strong>Dropout:</strong> 0.6</li>
<li><strong>Early stop:</strong> patience 2, min delta 0.002</li>
<li><strong>k-shots:</strong> 8 (current demo)</li>
</ul>
</div>
<div class="config-card">
<h3>Models</h3>
<ul>
<li><strong>Backbones:</strong> ViT-B/32, RN50</li>
<li><strong>Adapters:</strong> residual dual (image + text)</li>
<li><strong>Trainable params:</strong> 65,536 to 262,144</li>
<li><strong>Checkpoints:</strong> <code>models/best_*.pth</code></li>
</ul>
</div>
<div class="config-card">
<h3>Tracking</h3>
<ul>
<li><strong>Device:</strong> cuda</li>
<li><strong>WandB project:</strong> coco_caption_classification</li>
<li><strong>WandB entity:</strong> thailearncoding-ho-chi-minh-university-of-technology</li>
<li><strong>Eval set:</strong> 11,640 samples</li>
</ul>
</div>
</div>
</section>
<section class="panel">
<h2>Exploratory data analysis (EDA)</h2>
<p>Category distribution and sample pairs from the curated subset.</p>
<div class="image-stack">
<div class="image-block">
<h3>Data distribution</h3>
<img src="images/data_dist.png" alt="Data Distribution Bar Chart">
</div>
<div class="image-block">
<h3>Samples with captions</h3>
<img src="images/samples_plot.png" alt="Sample Image Grid">
</div>
</div>
</section>
<section class="panel">
<h2>Model architecture</h2>
<p>Frozen CLIP backbones with residual adapters for few-shot alignment.</p>
<div class="image-grid">
<img src="images/CLIP_architecture.png" alt="Architecture of CLIP model">
<img src="images/Few-shot_architecture.png" alt="Residual Dual for few-shot using CLIP">
</div>
</section>
<section class="panel">
<h2>Training phase (loss curves)</h2>
<p>Training curves per model (loss, train accuracy, eval accuracy, and F1 scores).</p>
<div class="chart-grid">
<div id="vitTrainPlot" style="height: 360px;"></div>
<div id="rn50TrainPlot" style="height: 360px;"></div>
</div>
</section>
<section class="panel">
<h2>Evaluation</h2>
<p>Zero-shot and 8-shot results across backbones.</p>
<div class="stat-grid">
<div class="stat-card">
<span>Zero-shot accuracy</span>
<strong>90.17%</strong>
<p>RN50 backbone on 11,640 samples.</p>
</div>
<div class="stat-card">
<span>Few-shot accuracy</span>
<strong>90.00%</strong>
<p>ViT-B/32 with 8-shot adapters.</p>
</div>
<div class="stat-card">
<span>Inference speed</span>
<strong>12.26 ms</strong>
<p>Avg per sample (ViT-B/32, 8-shot).</p>
</div>
<div class="stat-card">
<span>Trainable params</span>
<strong>65k to 262k</strong>
<p>Lightweight residual adapters only.</p>
</div>
</div>
<h3>Model comparison</h3>
<div style="overflow-x: auto;">
<table class="performance-table">
<thead>
<tr>
<th>Model</th>
<th>Shots</th>
<th>Mode</th>
<th>Accuracy</th>
<th>F1 Macro</th>
<th>F1 Micro</th>
<th>F1 Weighted</th>
<th>Time (s)</th>
<th>Time / Sample (ms)</th>
</tr>
</thead>
<tbody>
<tr>
<td><strong>RN50</strong></td>
<td>0</td>
<td>Zero-shot</td>
<td>0.901718</td>
<td>0.901566</td>
<td>0.901718</td>
<td>0.901697</td>
<td>153.556601</td>
<td>13.192148</td>
</tr>
<tr>
<td><strong>RN50</strong></td>
<td>8</td>
<td>Few-shot</td>
<td>0.891924</td>
<td>0.891877</td>
<td>0.891924</td>
<td>0.891938</td>
<td>152.817952</td>
<td>13.128690</td>
</tr>
<tr>
<td><strong>ViT-B/32</strong></td>
<td>0</td>
<td>Zero-shot</td>
<td>0.899656</td>
<td>0.899521</td>
<td>0.899656</td>
<td>0.899657</td>
<td>143.099318</td>
<td>12.293756</td>
</tr>
<tr>
<td><strong>ViT-B/32</strong></td>
<td>8</td>
<td>Few-shot</td>
<td>0.900000</td>
<td>0.900034</td>
<td>0.900000</td>
<td>0.900013</td>
<td>142.681351</td>
<td>12.257848</td>
</tr>
</tbody>
</table>
</div>
<h3>Evaluation curves by model</h3>
<p>Each plot groups metrics for a single backbone across k-shot values.</p>
<div class="chart-grid">
<div id="vitEvalPlot" style="height: 360px;"></div>
<div id="rn50EvalPlot" style="height: 360px;"></div>
</div>
</section>
<section class="panel">
<h2>Attention maps</h2>
<p>GradCAM and attention rollouts show where the model focuses.</p>
<div class="image-grid">
<img src="images/grad_cam.png" alt="GradCAM interpretations">
</div>
</section>
<section class="panel">
<h2>Hard cases</h2>
<p>Misclassified or ambiguous samples for error analysis.</p>
<div class="image-grid grid-2">
<img src="images/hardcase_1.png" alt="Hard case 1">
<img src="images/hardcase_2.png" alt="Hard case 2">
<img src="images/hardcase_3.png" alt="Hard case 3">
<img src="images/hardcase_4.png" alt="Hard case 4">
</div>
</section>
<footer>
<p>Built with PyTorch, CLIP, Streamlit, and WandB.</p>
</footer>
</main>
<script src="https://cdn.plot.ly/plotly-2.32.0.min.js"></script>
<script>
const plotFiles = [
{ id: "vitTrainPlot", file: "plot/vit_b32_train.json" },
{ id: "rn50TrainPlot", file: "plot/rn50_train.json" },
{ id: "vitEvalPlot", file: "plot/vit_b32_eval.json" },
{ id: "rn50EvalPlot", file: "plot/rn50_eval.json" }
];
plotFiles.forEach(({ id, file }) => {
fetch(file)
.then((res) => res.json())
.then((fig) => Plotly.newPlot(id, fig.data, fig.layout))
.catch(() => {
const el = document.getElementById(id);
if (el) {
el.innerHTML = "<p style='color:#7a7f8a;'>Plot JSON not found: " + file + "</p>";
}
});
});
</script>
</body>
</html>