Instructions to use keras/mit_b0_ade20k_512 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- KerasHub
How to use keras/mit_b0_ade20k_512 with KerasHub:
import keras_hub import keras # Load ImageClassifier model image_classifier = keras_hub.models.ImageClassifier.from_preset( "hf://keras/mit_b0_ade20k_512", 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/mit_b0_ade20k_512") - Keras
How to use keras/mit_b0_ade20k_512 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/mit_b0_ade20k_512") - Notebooks
- Google Colab
- Kaggle
| { | |
| "module": "keras_hub.src.models.mit.mit_backbone", | |
| "class_name": "MiTBackbone", | |
| "config": { | |
| "name": "mi_t_backbone", | |
| "trainable": true, | |
| "layerwise_depths": [ | |
| 2, | |
| 2, | |
| 2, | |
| 2 | |
| ], | |
| "hidden_dims": [ | |
| 32, | |
| 64, | |
| 160, | |
| 256 | |
| ], | |
| "image_shape": [ | |
| 224, | |
| 224, | |
| 3 | |
| ], | |
| "num_layers": 4, | |
| "layerwise_num_heads": [ | |
| 1, | |
| 2, | |
| 5, | |
| 8 | |
| ], | |
| "layerwise_sr_ratios": [ | |
| 8, | |
| 4, | |
| 2, | |
| 1 | |
| ], | |
| "max_drop_path_rate": 0.1, | |
| "layerwise_patch_sizes": [ | |
| 7, | |
| 3, | |
| 3, | |
| 3 | |
| ], | |
| "layerwise_strides": [ | |
| 4, | |
| 2, | |
| 2, | |
| 2 | |
| ] | |
| }, | |
| "registered_name": "keras_hub>MiTBackbone" | |
| } |