Skip to main content
Extract DINOv2-base patch tokens and the [CLS] token for one RGB image.

Parameters

ImageInput
required
RGB image as file path, URL, PIL Image, or numpy array.
float | None
Optional timeout in seconds for the HTTP request.

Returns

Dict[str, np.ndarray]: Dict with patch_tokens of shape (16, 16, 768) and cls of shape (768,), both float32 and L2-normalized per vector. Pool patch_tokens over a foreground mask and re-normalize to compare crops by cosine similarity without their background.

Example