Basics · 14×14 Spatial PCA & Norm Profile · 87.45 MB WASM q8

14×14 Patch RGB PCA, Norm Profile & Pooling Anatomy

Without an ImageNet-1k classification head, ViT-Base IN21k exposes 196 spatial patch vectors (16×16 px each) alongside the global [CLS] token. Run 3-component RGB PCA to separate foreground structure, inspect patch L2 norms, and compare [CLS] vs Mean Patch vs Fused pooling cosine similarity against any reference image.

1. Model & Photo Input

Initialise ViT-Base IN21k above to compute 3-component RGB PCA and Patch L2-Norm diagnostics.

PCA Variance (3 PCs)–
FG Patches–
[CLS] L2 Norm–
Median / Max Norm–
Patches > 1.5× Med–
[CLS] vs Ref Cos–
Mean Patch vs Ref–
Tensor NaN Count–

3-Component Patch RGB PCA (14×14)

Waiting for forward pass…

Patch L2-Norm Profile (14×14)

Patches > 1.5× median highlighted in gold

Pooling Strategy Comparison vs Reference ([CLS] vs Mean Patch vs Fused)

Because supervised ImageNet-21k trains its classification probe directly on index 0 ([CLS]), [CLS] cosine separates semantic categories cleanly while Mean Patch captures overall texture and layout.

Show the code

Show the code — vit21k-core.mjs: computePatchPcaRgb() (power-iteration 3-PC RGB projection)