Instructions to use keras/deit_base_distilled_patch16_384_imagenet with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/deit_base_distilled_patch16_384_imagenet with KerasHub:
import keras_hub import keras # Load ImageClassifier model image_classifier = keras_hub.models.ImageClassifier.from_preset( "hf://keras/deit_base_distilled_patch16_384_imagenet", num_classes=2, ) # Fine-tune image_classifier.fit( x=keras.random.randint((32, 64, 64, 3), 0, 256), y=keras.random.randint((32, 1), 0, 2), ) # Classify image image_classifier.predict(keras.random.randint((1, 64, 64, 3), 0, 256))import keras_hub # Create a Backbone model unspecialized for any task backbone = keras_hub.models.Backbone.from_preset("hf://keras/deit_base_distilled_patch16_384_imagenet") - Keras
How to use keras/deit_base_distilled_patch16_384_imagenet with Keras:
# Available backend options are: "jax", "torch", "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" import keras model = keras.saving.load_model("hf://keras/deit_base_distilled_patch16_384_imagenet") - Notebooks
- Google Colab
- Kaggle
Model Overview
Data-efficient Image Transformer (DeiT).
Reference
ViT models required training on expensive infrastructure for multiple weeks, using external data. DeiT (data-efficient image transformers) are more efficiently trained transformers for image classification, requiring far less data and far less computing resources compared to the original ViT models.
Links
- [DeiT Quickstart Notebook] - coming soon
- [DeiT API Documentation] - coming soon
- [DeiT Beginner Guide] - coming soon
- KerasHub Model Publishing Guide
Installation
Keras and KerasHub can be installed with:
pip install -U -q keras-hub
pip install -U -q keras
Jax, TensorFlow, and Torch come preinstalled in Kaggle Notebooks. For instructions on installing them in another environment see the Keras Getting Started page.
Presets
The following model checkpoints are provided by the Keras team. Weights have been ported from: https://huggingface.co. Full code examples for each are available below.
| Preset name | Parameters | Description |
|---|---|---|
| deit_tiny_distilled_patch16_224_imagenet | 5.52M | DeiT-T16 model pre-trained on the ImageNet 1k dataset with image resolution of 224x224 |
| deit_small_distilled_patch16_224_imagenet | 21.66M | DeiT-S16 model pre-trained on the ImageNet 1k dataset with image resolution of 224x224 |
| deit_base_distilled_patch16_224_imagenet | 85.80M | DeiT-B16 model pre-trained on the ImageNet 1k dataset with image resolution of 224x224 . |
| deit_base_distilled_patch16_384_imagenet | 86.09M | DeiT-B16 model pre-trained on the ImageNet 1k dataset with image resolution of 384x384 |
- Downloads last month
- 2