Instructions to use zeromodels/dinov2-base with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use zeromodels/dinov2-base with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://zeromodels/dinov2-base") - Notebooks
- Google Colab
- Kaggle
fix readme.md
Browse files
README.md
CHANGED
|
@@ -25,7 +25,8 @@ tags:
|
|
| 25 |
|
| 26 |
Paper: [DINOv2: Learning Robust Visual Features without Supervision (arXiv:2304.07193)](https://arxiv.org/abs/2304.07193) 路 [HF Papers](https://huggingface.co/papers/2304.07193)
|
| 27 |
|
| 28 |
-
DINOv2 scales self-supervised ViT pretraining for strong transferable visual features without labels. These checkpoints are backbones that return patch tokens for downstream heads.
|
|
|
|
| 29 |
For more details on the model, please go to the upstream [model card](https://huggingface.co/facebook/dinov2-base).
|
| 30 |
|
| 31 |
Pure-**Keras 3** conversion of [`facebook/dinov2-base`](https://huggingface.co/facebook/dinov2-base) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
|
|
@@ -40,9 +41,9 @@ os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
|
|
| 40 |
|
| 41 |
import numpy as np
|
| 42 |
from PIL import Image
|
| 43 |
-
from
|
| 44 |
|
| 45 |
-
model =
|
| 46 |
image = Image.open("your_image.jpg").convert("RGB")
|
| 47 |
x = np.asarray(image.resize((448, 448)))[None].astype("float32")
|
| 48 |
tokens = model(x, training=False)
|
|
|
|
| 25 |
|
| 26 |
Paper: [DINOv2: Learning Robust Visual Features without Supervision (arXiv:2304.07193)](https://arxiv.org/abs/2304.07193) 路 [HF Papers](https://huggingface.co/papers/2304.07193)
|
| 27 |
|
| 28 |
+
DINOv2 scales self-supervised ViT pretraining for strong transferable visual features without labels. These checkpoints are backbones that return patch tokens for downstream heads.
|
| 29 |
+
|
| 30 |
For more details on the model, please go to the upstream [model card](https://huggingface.co/facebook/dinov2-base).
|
| 31 |
|
| 32 |
Pure-**Keras 3** conversion of [`facebook/dinov2-base`](https://huggingface.co/facebook/dinov2-base) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
|
|
|
|
| 41 |
|
| 42 |
import numpy as np
|
| 43 |
from PIL import Image
|
| 44 |
+
from kerasformers.models.dino_v2 import DinoV2Model
|
| 45 |
|
| 46 |
+
model = DinoV2Model.from_weights("kerasformers/dinov2_vitb14", image_size=448)
|
| 47 |
image = Image.open("your_image.jpg").convert("RGB")
|
| 48 |
x = np.asarray(image.resize((448, 448)))[None].astype("float32")
|
| 49 |
tokens = model(x, training=False)
|