In this article
Global image features and patch embeddings answer different questions; their tensor shapes are part of the application contract.
Start with the output’s intended use
A visual inspection application may need to find similar photographs, while another application must mark a defective region. Both can use a DINOv2 backbone, but they need different outputs. The original paper studies transferable visual representations rather than promising a finished detector for every domain. Decide whether the downstream consumer expects an image-level representation or a spatial grid before selecting a pooling operation.
Separate image and patch representations
The Transformers integration distinguishes the whole-image classification token from local patch embeddings. Flattening every token into an arbitrary vector removes this distinction. Conversely, reshaping a global token as if it described an image position creates a false spatial interpretation. Read the selected model’s output structure, including whether a wrapper has already pooled or reshaped its hidden states. Register-token variants additionally contain non-spatial register tokens; exclude these from image patch grids according to the selected variant’s documented output convention.
Preserve the processor’s geometry
The patch grid corresponds to the image delivered to the encoder after resizing and cropping, not automatically to the original photograph. Store the processor configuration with cached features. To overlay a dense prediction, reconstruct the relevant transformation back to the original canvas. The official implementation provides the reference model variants and extraction utilities; a similarly named third-party wrapper can still expose a different output convention.
Keep feature comparison internally consistent
For a retrieval experiment, extract the query and reference vectors with the same checkpoint, processor and feature-selection rule. Specify normalization and similarity separately. For a dense task, train or evaluate the downstream head using the same patch convention used at inference. A plausible nearest neighbor or colorful feature visualization does not independently establish that the representation captures the operational distinction the application needs.
Inspect a representative failure
Consider a defect that occupies a small part of a product photograph. A global representation can preserve overall product similarity while underweighting the defect, whereas a local map retains positions but still requires an appropriate decision rule. Compare both against labeled examples instead of choosing by embedding size. The guides to image patch tokens and contrastive image-text spaces explain related mechanisms, but DINOv2 feature selection remains a separate application decision.
Earn rental income from GPUs
Have idle GPUs or looking to fund AI infrastructure? Retrivium finds a rental platform, sets up the server and helps you assess income and costs with a pilot.