dino-vitb16

The facebook/dino-vitb16 model is a Vision Transformer (ViT‑B/16) that has been pre‑trained on the ImageNet‑1k dataset using the DINO (self‑supervised) learning

facebook 253K downloads apache-2.0 Image Features
Frameworkstransformerspytorchtf
Datasetsimagenet-1k
Tagsvitimage-feature-extractiondinovision
Downloads
253K
License
apache-2.0
Pipeline
Image Features
Author
facebook

Run dino-vitb16 locally on a Q4KM hard drive

Speed up deployment with Q4KM hard drives pre‑loaded with the DINO ViT‑B/16 model . Get instant access, optimized storage layout, and 24/7 support for production workloads. Helpful Links Model Card...

Shop Q4KM Drives

Technical Overview

The facebook/dino-vitb16 model is a Vision Transformer (ViT‑B/16) that has been pre‑trained on the ImageNet‑1k dataset using the DINO (self‑supervised) learning framework. It is a pure encoder – the model does not ship with any task‑specific classification head, making it ideal for image‑feature extraction and downstream fine‑tuning.

Key Features & Capabilities

  • Base‑size ViT – 12 Transformer layers, 768 hidden dimensions, 12 attention heads.
  • Patch size 16×16 – each 224×224 image is split into 14×14 patches, yielding a sequence length of 197 (including the CLS token).
  • Self‑supervised pre‑training – DINO learns rich visual representations without labels, improving transferability to many downstream tasks.
  • Image‑feature extraction – the CLS token’s final hidden state can be used as a compact image descriptor; all token embeddings can be pooled for dense tasks.
  • Framework compatibility – available through 🤗 Transformers (PyTorch) and also compatible with TensorFlow via the tf tag.

Architecture Highlights

The model follows the standard ViT‑B/16 design introduced by Dosovitskiy et al. 2020, with the following specifics:

  • Embedding layer – linear projection of each 16×16 patch (3 × 16 × 16 = 768) into 768‑dimensional token embeddings.
  • Learned positional encodings – absolute 2‑D sinusoidal embeddings added to each token.
  • Transformer encoder – 12 identical blocks, each containing a multi‑head self‑attention (12 heads) and a feed‑forward network (4× hidden size).
  • Layer‑norm and residual connections – applied before and after each sub‑layer, following the “Pre‑Norm” convention.
  • CLS token – prepended to the patch sequence; its final hidden state is the canonical image representation.

Intended Use Cases

  • Feature extraction for downstream classifiers (linear probing, fine‑tuning).
  • Image retrieval and similarity search using CLS embeddings.
  • Transfer learning for segmentation, detection, or multimodal tasks (e.g., CLIP‑style training).
  • Research on self‑supervised vision representations.

Benchmark Performance

Because facebook/dino-vitb16 is a self‑supervised encoder, the most common benchmark is linear probing accuracy on ImageNet‑1k. The original DINO paper reports a top‑1 accuracy of ≈ 78 % when a linear classifier is trained on top of the frozen CLS token, which is competitive with supervised ViT‑B/16 (≈ 77 %). The model also achieves strong performance on downstream tasks such as object detection (COCO) and semantic segmentation (ADE20K) when fine‑tuned, although exact numbers depend on the fine‑tuning recipe.

These benchmarks matter because they demonstrate that the encoder captures high‑level semantic information without any label supervision. A high linear‑probe score indicates that the learned features are readily reusable, reducing the amount of labeled data needed for downstream applications.

When compared to other ViT‑B/16 variants:

  • Supervised ViT‑B/16 – ~77 % top‑1 (linear probe), ~81 % top‑1 (full fine‑tune).
  • DINO ViT‑B/16 – ~78 % top‑1 (linear probe), often surpasses supervised when fine‑tuned on limited data.
  • MAE ViT‑B/16 – similar linear‑probe performance (~77–78 %) but different training dynamics.

Hardware Requirements

The facebook/dino-vitb16 checkpoint is ~400 MB (weights only). Inference for a single 224×224 image requires roughly 1 GB of GPU memory for the model plus an additional ~0.5 GB for the input tensor and intermediate activations. For batch inference, memory scales linearly with batch size.

Recommended GPU

  • Desktop / workstation: NVIDIA RTX 3060 (12 GB VRAM) or higher.
  • Data‑center: NVIDIA A100 (40 GB) or V100 (32 GB) for large‑scale batch processing.

CPU & Storage

  • CPU: Any modern x86_64 CPU; inference speed improves with 8+ cores.
  • RAM: 8 GB minimum; 16 GB recommended for parallel preprocessing.
  • Disk: 1 GB free space for model files, plus additional space for datasets (ImageNet‑1k ≈ 150 GB).

Performance Characteristics

On a RTX 3060, a single forward pass (batch = 1) takes ~12 ms (≈ 80 FPS) in PyTorch with torch.float16 mixed‑precision. Using torch.cuda.amp can reduce latency by ~30 % while keeping numerical stability. Larger batches (e.g., 32) can be processed at ~2 ms per image under the same hardware.

Use Cases

Because the model is a pure feature extractor, it shines in scenarios where high‑quality visual embeddings are needed without the overhead of task‑specific heads.

  • Image classification pipelines: Use the CLS token as a fixed‑length descriptor and train a lightweight linear classifier on a small labeled dataset.
  • Content‑based image retrieval: Index CLS embeddings in a vector database (e.g., FAISS) for fast similarity search.
  • Transfer learning for detection/segmentation: Initialize Faster‑RCNN or Mask‑RCNN backbones with the ViT‑B/16 weights and fine‑tune on COCO or ADE20K.
  • Multimodal research: Pair the visual encoder with a text encoder (e.g., BERT) to explore cross‑modal alignment.
  • Edge‑device inference: With mixed‑precision, the model fits on modern mobile GPUs (e.g., Snapdragon 8 Gen 2) for on‑device feature extraction.

Training Details

The model was trained following the DINO recipe described in the 2021 paper:

  • Dataset: ImageNet‑1k (1.28 M images, 1000 classes) – used without labels.
  • Training objective: Self‑distillation with a teacher‑student architecture; the teacher’s parameters are an exponential moving average of the student’s.
  • Data augmentations: Multi‑crop strategy (2 global crops + 6 local crops), random resized cropping, color jitter, Gaussian blur, and solarization.
  • Optimization: AdamW, learning rate 0.0005 (scaled with batch size), weight decay 0.04, cosine annealing schedule over 100 epochs.
  • Batch size: 4096 images per iteration (distributed across 8 × A100 GPUs).
  • Compute: Roughly 2 days on a single 8‑GPU A100 node (≈ 256 GPU‑hours).
  • Fine‑tuning capability: The model can be fine‑tuned on downstream datasets by adding a classification head (e.g., ViTForImageClassification) and training end‑to‑end or with a frozen encoder.

Licensing Information

The repository’s README lists the license as Apache‑2.0. The model card’s metadata shows “license: unknown”, which is a discrepancy often caused by missing metadata during upload. In practice, the underlying code and weights are released under the Apache‑2.0 license, a permissive open‑source license.

  • Commercial use: Allowed. You may embed the model in commercial products, SaaS offerings, or hardware devices.
  • Modification & redistribution: You may modify the model weights or code and redistribute them, provided you retain the original copyright notice and license text.
  • Patent grant: Apache‑2.0 includes an explicit patent license, protecting downstream users from patent claims related to the contributed code.
  • Attribution: Required. Cite the original DINO paper (see “Related Papers” section) and include a copy of the Apache‑2.0 license in your distribution.

If you plan to use the model in a regulated environment (e.g., medical devices), verify that the “unknown” tag does not conflict with your internal compliance policies and consider contacting the model uploader for clarification.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives