Instructions to use zeromodels/dino-vitb8 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Keras
How to use zeromodels/dino-vitb8 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/dino-vitb8") - Notebooks
- Google Colab
- Kaggle
Rename to official model id; sync variant + links
Browse files
README.md
CHANGED
|
@@ -21,7 +21,7 @@ tags:
|
|
| 21 |
|
| 22 |
[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/dino/) [](https://huggingface.co/collections/kerasformers/dino-v1-v2-v3-6a6a94f8281a2f373f70e769)
|
| 23 |
|
| 24 |
-
# kerasformers/
|
| 25 |
|
| 26 |
Paper: [Emerging Properties in Self-Supervised Vision Transformers (arXiv:2104.14294)](https://arxiv.org/abs/2104.14294) 路 [HF Papers](https://huggingface.co/papers/2104.14294)
|
| 27 |
|
|
@@ -44,9 +44,9 @@ from kerasformers.models.dino import DinoViTModel, DinoImageProcessor
|
|
| 44 |
# The processor resizes + ImageNet-normalizes, so build the model with
|
| 45 |
# include_normalization=False (it would otherwise normalize a second time).
|
| 46 |
model = DinoViTModel.from_weights(
|
| 47 |
-
"kerasformers/
|
| 48 |
)
|
| 49 |
-
processor = DinoImageProcessor.from_weights("kerasformers/
|
| 50 |
|
| 51 |
pixel_values = processor("your_image.jpg")["pixel_values"]
|
| 52 |
features = model(pixel_values, training=False)
|
|
@@ -57,17 +57,17 @@ Load any DINO variant the same way with `from_weights("kerasformers/<variant>")`
|
|
| 57 |
|
| 58 |
| Variant | Hub | Backbone |
|
| 59 |
|---|---|---|
|
| 60 |
-
| `
|
| 61 |
-
| `
|
| 62 |
-
| `
|
| 63 |
-
| `
|
| 64 |
-
| `
|
| 65 |
|
| 66 |
## Tips
|
| 67 |
|
| 68 |
- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
|
| 69 |
- The processor normalizes; pair it with `include_normalization=False`. To skip it, feed raw `[0, 255]` pixels and keep the default `include_normalization=True`.
|
| 70 |
-
- `
|
| 71 |
- See [DINO docs](https://imvision12.github.io/KerasFormers/dino/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
|
| 72 |
- Community / upstream weights: `DinoViTModel.from_weights("hf:facebook/dino-vitb8")`.
|
| 73 |
|
|
|
|
| 21 |
|
| 22 |
[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/dino/) [](https://huggingface.co/collections/kerasformers/dino-v1-v2-v3-6a6a94f8281a2f373f70e769)
|
| 23 |
|
| 24 |
+
# kerasformers/dino-vitb8
|
| 25 |
|
| 26 |
Paper: [Emerging Properties in Self-Supervised Vision Transformers (arXiv:2104.14294)](https://arxiv.org/abs/2104.14294) 路 [HF Papers](https://huggingface.co/papers/2104.14294)
|
| 27 |
|
|
|
|
| 44 |
# The processor resizes + ImageNet-normalizes, so build the model with
|
| 45 |
# include_normalization=False (it would otherwise normalize a second time).
|
| 46 |
model = DinoViTModel.from_weights(
|
| 47 |
+
"kerasformers/dino-vitb8", include_normalization=False
|
| 48 |
)
|
| 49 |
+
processor = DinoImageProcessor.from_weights("kerasformers/dino-vitb8")
|
| 50 |
|
| 51 |
pixel_values = processor("your_image.jpg")["pixel_values"]
|
| 52 |
features = model(pixel_values, training=False)
|
|
|
|
| 57 |
|
| 58 |
| Variant | Hub | Backbone |
|
| 59 |
|---|---|---|
|
| 60 |
+
| `dino-vits16` | [`kerasformers/dino-vits16`](https://huggingface.co/kerasformers/dino-vits16) | ViT-S/16 |
|
| 61 |
+
| `dino-vits8` | [`kerasformers/dino-vits8`](https://huggingface.co/kerasformers/dino-vits8) | ViT-S/8 |
|
| 62 |
+
| `dino-vitb16` | [`kerasformers/dino-vitb16`](https://huggingface.co/kerasformers/dino-vitb16) | ViT-B/16 |
|
| 63 |
+
| `dino-vitb8` | [`kerasformers/dino-vitb8`](https://huggingface.co/kerasformers/dino-vitb8) | ViT-B/8 |
|
| 64 |
+
| `dino-resnet50` | [`kerasformers/dino-resnet50`](https://huggingface.co/kerasformers/dino-resnet50) | ResNet-50 |
|
| 65 |
|
| 66 |
## Tips
|
| 67 |
|
| 68 |
- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
|
| 69 |
- The processor normalizes; pair it with `include_normalization=False`. To skip it, feed raw `[0, 255]` pixels and keep the default `include_normalization=True`.
|
| 70 |
+
- `dino-resnet50` was converted from torch.hub `facebookresearch/dino`.
|
| 71 |
- See [DINO docs](https://imvision12.github.io/KerasFormers/dino/) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
|
| 72 |
- Community / upstream weights: `DinoViTModel.from_weights("hf:facebook/dino-vitb8")`.
|
| 73 |
|