Instructions to use kerasformers/dinov2-large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use kerasformers/dinov2-large with KerasFormers:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Keras
How to use kerasformers/dinov2-large with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://kerasformers/dinov2-large") - Notebooks
- Google Colab
- Kaggle
See our collection for all versions of DINOv2.
Run DINOv2 with Keras 3: JAX, PyTorch, or TensorFlow
kerasformers/dinov2-large
Paper: DINOv2: Learning Robust Visual Features without Supervision (arXiv:2304.07193) · HF Papers
DINOv2 scales self-supervised ViT pretraining for strong transferable visual features without labels. These checkpoints are backbones that return patch tokens for downstream heads.
For more details on the model, please go to the upstream model card.
Pure-Keras 3 conversion of facebook/dinov2-large for kerasformers. One implementation runs unmodified on TensorFlow / Torch / JAX.
This is a self-supervised backbone (DinoV2Model), not a task head.
✨ Quick start
import os
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
from kerasformers.models.dino_v2 import DinoV2Model, DinoV2ImageProcessor
# The processor resizes + ImageNet-normalizes, so build the model with
# include_normalization=False (it would otherwise normalize a second time).
model = DinoV2Model.from_weights(
"kerasformers/dinov2-large", include_normalization=False
)
processor = DinoV2ImageProcessor.from_weights("kerasformers/dinov2-large")
pixel_values = processor("your_image.jpg")["pixel_values"]
features = model(pixel_values, training=False)
print(pixel_values.shape, features.shape)
Load any DINOv2 variant the same way with from_weights("kerasformers/<variant>"):
| Variant | Hub | Backbone |
|---|---|---|
dinov2-small |
kerasformers/dinov2-small |
ViT-S/14 |
dinov2-base |
kerasformers/dinov2-base |
ViT-B/14 |
dinov2-large |
kerasformers/dinov2-large |
ViT-L/14 |
dinov2-giant |
kerasformers/dinov2-giant |
ViT-g/14 |
Tips
- Set
KERAS_BACKENDbefore importing Keras / kerasformers. - The processor normalizes; pair it with
include_normalization=False. To skip it, feed raw[0, 255]pixels and keep the defaultinclude_normalization=True. - See DINOv2 docs and Loading Weights.
- Community / upstream weights:
DinoV2Model.from_weights("hf:facebook/dinov2-large").
Special Thanks
A huge thank you to the Facebook AI Research DINOv2 authors for creating and releasing these models.
License: Apache 2.0.
- Downloads last month
- 24
Model tree for kerasformers/dinov2-large
Base model
facebook/dinov2-large