image-feature-extraction Β· Dinov2Model (dinov2) Β· CPU WASM q8 (90.97 MB) Β· Apache-2.0

DINOv2-Base β€” 91 MB 768-d Self-Supervised Representation Lab

Meta AI's Oquab et al. (2023) DINOv2 ViT-B/14 backbone (86.6M params, 90.97 MB q8 WASM, 0 register tokens, pretrained on LVD-142M). One forward pass emits [1, 257, 768] β€” a global [CLS] token plus a denser 16Γ—16 patch grid for zero-label part correspondence, PCA object discovery, and visual search.

At a glance

Verified model card and ONNX Hub metadata for DINOv2-Base
Upstream model facebook/dinov2-base (Meta AI Research β€” Oquab et al., TMLR 2024 / arXiv:2304.07193, self-supervised on LVD-142M)
Browser ONNX repo Xenova/dinov2-base (onnx/model_quantized.onnx β€” 90,974,542 B / 90.97 MB)
License Apache-2.0 (permissive open-source commercial & research use)
Task & architecture image-feature-extraction Β· Dinov2Model (dinov2, 86.6M params, 12 layers, 768-d hidden, 12 attention heads, 3072 MLP, GELU, LayerScale, 256px shortest-edge resize + 224Γ—224 center crop, patch 14, 0 register tokens)
Output tensor shape last_hidden_state shape [1, 257, 768] (197,376 values): index 0 = [CLS] (1Γ—768) Β· indices 1..256 = 16Γ—16 = 256 spatial patch tokens (256Γ—768)
Distinct from v1 & Registers/v3 Scales from ViT-S/16 (384-d, 14Γ—14 patches) up to ViT-B/14 (768-d, 16Γ—16 patches) with finer spatial resolution, while still running with 0 register tokens β€” exposing DINOv2's famous high-norm background "artifact" tokens that later motivated DINOv2-Registers and DINOv3.
Runtime & backend Shared Transformers.js pin (../../lib/webai.js) Β· CPU WASM q8 (90.97 MB, universal; runs off-main-thread in worker.js)

1. Live 16Γ—16 Patch Cosine Explorer

Drop an image anywhere in this box, paste from clipboard (Ctrl/⌘+V), capture from webcam, or pick a curated photo below.

Initialise DINOv2-Base above, then click or arrow-key any 16Γ—16 cell to inspect patch cosine similarity.

Photo: – Click or arrow-key any 16Γ—16 cell to probe patch cosine

Live [1, 257, 768] Tensor Anatomy

DINOv2-Base uses 0 register tokens: index 0 is the global [CLS] vector and indices 1..256 map directly to the 16Γ—16 spatial grid.

Index 0 [CLS] (1Γ—768)
Indices 1..256 16Γ—16 Patches (256Γ—768) Β· 0 Registers

Patch norm spread & top cosine matches will appear here after the forward pass.

Backend–
Tensor Shape–
Infer Latency–
[CLS] L2 Norm–
Patch Norm Spread–
Selected Patch(8, 8)
Patches β‰₯ 0.60 Cos–
Tensor NaN Count–

Why DINOv2-Base matters

DINOv2 scaled self-supervised ViT pretraining to the curated LVD-142M dataset with patch-14 tokenization, producing general-purpose visual features that transfer zero-shot across retrieval, dense segmentation, depth, and correspondence. At 90.97 MB under Apache-2.0 and universal CPU WASM, DINOv2-Base unlocks:

Use-case ladder

How the API works

Load Xenova/dinov2-base once via the shared Transformers.js image-feature-extraction pipeline on WASM q8, then run pipe.processor(image) + pipe.model(inputs) inside a dedicated Web Worker to unpack last_hidden_state ([1, 257, 768]).

Show the code β€” worker.js: extractFeatures() ([1, 257, 768] unpacking + real nanCount)

References