Views
No views yet
pip install -U -q keras-Hub
pip install -U -q keras>=3| Preset Name | Parameters | Description |
|---|---|---|
| vgg_11_imagenet | 9.22M | 11-layer VGG model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
| vgg_13_imagenet | 9.40M | 13-layer VGG model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
| vgg_16_imagenet | 14.71M | 16-layer VGG model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
| vgg_19_imagenet | 20.02M | 19-layer VGG model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
1input_data = np.ones(shape=(2, 224, 224, 3))
2
3# Pretrained backbone
4model = keras_hub.models.VGGBackbone.from_preset("vgg_16_imagenet")
5model(input_data)
6
7# Randomly initialized backbone with a custom config
8model = keras_hub.models.VGGBackbone(
9 stackwise_num_repeats=[2, 3, 3, 2],
10 stackwise_num_filters=[64, 128, 256, 512],
11)
12model(input_data)
13
14# Use VGG for image classification task
15model = keras_hub.models.ImageClassifier.from_preset("vgg_16_imagenet")
16
17# User Timm presets directly from HuggingFace
18model = keras_hub.models.ImageClassifier.from_preset('hf://timm/vgg11.tv_in1k')1input_data = np.ones(shape=(2, 224, 224, 3))
2
3# Pretrained backbone
4model = keras_hub.models.VGGBackbone.from_preset("hf://keras/vgg_16_imagenet")
5model(input_data)
6
7# Randomly initialized backbone with a custom config
8model = keras_hub.models.VGGBackbone(
9 stackwise_num_repeats=[2, 3, 3, 2],
10 stackwise_num_filters=[64, 128, 256, 512],
11)
12model(input_data)
13
14# Use VGG for image classification task
15model = keras_hub.models.ImageClassifier.from_preset("hf://keras/vgg_16_imagenet")
16
17# User Timm presets directly from HuggingFace
18model = keras_hub.models.ImageClassifier.from_preset('hf://timm/vgg11.tv_in1k')