Views
No views yet
pip install -U -q keras-hub
pip install -U -q keras| Model ID | img_size | Acc | Top-5 | Parameters |
|---|---|---|---|---|
| Base | ||||
| vit_base_patch16_224_imagenet | 224 | - | - | 85798656 |
| vit_base_patch_16_224_imagenet21k | 224 | - | - | 85798656 |
| vit_base_patch_16_384_imagenet | 384 | - | - | 86090496 |
| vit_base_patch32_224_imagenet21k | 224 | - | - | 87455232 |
| vit_base_patch32_384_imagenet | 384 | - | - | 87528192 |
| Large | ||||
| vit_large_patch16_224_imagenet | 224 | - | - | 303301632 |
| vit_large_patch16_224_imagenet21k | 224 | - | - | 303301632 |
| vit_large_patch16_384_imagenet | 224 | - | - | 303690752 |
| vit_large_patch32_224_imagenet21k | 224 | - | - | 305510400 |
| vit_large_patch32_384_imagenet | 224 | - | - | 305607680 |
| Huge | ||||
| vit_huge_patch14_224_imagenet21k | 224 | - | - | 630764800 |
image_classifier = keras_hub.models.ImageClassification.from_preset(
"vit_base_patch32_224_imagenet21k"
)
input_data = np.random.uniform(0, 1, size=(2, 224, 224, 3))
image_classifier(input_data)1backbone = keras_hub.models.Backbone.from_preset(
2 "vit_base_patch32_224_imagenet21k"
3)
4preprocessor = keras_hub.models.ViTImageClassifierPreprocessor.from_preset(
5 "vit_base_patch32_224_imagenet21k"
6)
7model = keras_hub.models.ViTImageClassifier(
8 backbone=backbone,
9 num_classes=len(CLASSES),
10 preprocessor=preprocessor,
11)image_classifier = keras_hub.models.ImageClassification.from_preset(
"hf://keras/vit_base_patch32_224_imagenet21k"
)
input_data = np.random.uniform(0, 1, size=(2, 224, 224, 3))
image_classifier(input_data)1backbone = keras_hub.models.Backbone.from_preset(
2 "hf://keras/vit_base_patch32_224_imagenet21k"
3)
4preprocessor = keras_hub.models.ViTImageClassifierPreprocessor.from_preset(
5 "hf://keras/vit_base_patch32_224_imagenet21k"
6)
7model = keras_hub.models.ViTImageClassifier(
8 backbone=backbone,
9 num_classes=len(CLASSES),
10 preprocessor=preprocessor,
11)