Instructions to use kerasformers/dino-resnet50 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasFormers
How to use kerasformers/dino-resnet50 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/dino-resnet50 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/dino-resnet50") - Notebooks
- Google Colab
- Kaggle
See our collection for all versions of DINO.
Run DINO with Keras 3: JAX, PyTorch, or TensorFlow
kerasformers/dino-resnet50
Paper: Emerging Properties in Self-Supervised Vision Transformers (arXiv:2104.14294) · HF Papers
DINO is self-supervised: a student and teacher match across crops of the same image with no labels. The resulting features are semantic for free. These checkpoints are backbones that return tokens / feature maps.
Pure-Keras 3 port for kerasformers, converted from the official upstream release. One implementation runs unmodified on TensorFlow / Torch / JAX.
This is a self-supervised backbone (DinoResNetModel), not a task head.
✨ Quick start
import os
os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
from kerasformers.models.dino import DinoResNetModel, DinoImageProcessor
# The processor resizes + ImageNet-normalizes, so build the model with
# include_normalization=False (it would otherwise normalize a second time).
model = DinoResNetModel.from_weights(
"kerasformers/dino-resnet50", include_normalization=False
)
processor = DinoImageProcessor.from_weights("kerasformers/dino-resnet50")
pixel_values = processor("your_image.jpg")["pixel_values"]
features = model(pixel_values, training=False)
print(pixel_values.shape, features.shape)
Load any DINO variant the same way with from_weights("kerasformers/<variant>"):
| Variant | Hub | Backbone |
|---|---|---|
dino-vits16 |
kerasformers/dino-vits16 |
ViT-S/16 |
dino-vits8 |
kerasformers/dino-vits8 |
ViT-S/8 |
dino-vitb16 |
kerasformers/dino-vitb16 |
ViT-B/16 |
dino-vitb8 |
kerasformers/dino-vitb8 |
ViT-B/8 |
dino-resnet50 |
kerasformers/dino-resnet50 |
ResNet-50 |
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. dino-resnet50was converted from torch.hubfacebookresearch/dino.- See DINO docs and Loading Weights.
- Community / upstream weights: See the KerasFormers docs for upstream conversion notes.
Special Thanks
A huge thank you to the Facebook AI Research DINO authors for creating and releasing these models.
License: Apache 2.0.
- Downloads last month
- 34