Downloads · 30 days
8
4% of all-time downloads
keras/resnet_v2_50_imagenet
resnet_v2_50_imagenet is a image classification model from keras. Use it when you need a label for an image. It is set up for keras-hub. The card lists the license as apache-2.0.
Instantiates the ResNetV2 architecture. This model is supported in both KerasCV and KerasHub. KerasCV will no longer be actively developed, so please try to use KerasHub.
Downloads · 30 days
8
4% of all-time downloads
All-time downloads
210
Public
Repo size
197 MB
Likes
0
Public
Click a slice to open those files.
.h5197 MB · 100%
From the Hugging Face model README
Instantiates the ResNetV2 architecture. This model is supported in both KerasCV and KerasHub. KerasCV will no longer be actively developed, so please try to use KerasHub.
Reference
The difference in Resnet and ResNetV2 rests in the structure of their individual building blocks. In ResNetV2, the batch normalization and ReLU activation precede the convolution layers, as opposed to ResNetV1 where the batch normalization and ReLU activation are applied after the convolution layers.
For transfer learning use cases, make sure to read the guide to transfer learning & fine-tuning.
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.
The following model checkpoints are provided by the Keras team. Weights have been ported from: https://huggingface.co/timm. Full code examples for each are available below.
| Preset name | Parameters | Description |
|---|---|---|
| resnet_v2_50_imagenet | 23.56M | 50-layer ResNetV2 model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
| resnet_v2_101_imagenet | 42.61M | 101-layer ResNetV2 model pre-trained on the ImageNet 1k dataset at a 224x224 resolution. |
# Pretrained ResNet backbone.
model = keras_hub.models.ResNetBackbone.from_preset("resnet_v2_50_imagenet")
input_data = np.random.uniform(0, 1, size=(2, 224, 224, 3))
model(input_data)
# Randomly initialized ResNetV2 backbone with a custom config.
model = keras_hub.models.ResNetBackbone(
input_conv_filters=[64],
input_conv_kernel_sizes=[7],
stackwise_num_filters=[64, 64, 64],
stackwise_num_blocks=[2, 2, 2],
stackwise_num_strides=[1, 2, 2],
block_type="basic_block",
use_pre_activation=True,
)
model(input_data)
# Use resnet for image classification task
model = keras_hub.models.ImageClassifier.from_preset("resnet_v2_50_imagenet")
# User timm presets directly from hugingface
model = keras_hub.models.ImageClassifier.from_preset('hf://timm/resnetv2_101.a1h_in1k')
# Pretrained ResNet backbone.
model = keras_hub.models.ResNetBackbone.from_preset("hf://keras/resnet_v2_50_imagenet")
input_data = np.random.uniform(0, 1, size=(2, 224, 224, 3))
model(input_data)
# Randomly initialized ResNetV2 backbone with a custom config.
model = keras_hub.models.ResNetBackbone(
input_conv_filters=[64],
input_conv_kernel_sizes=[7],
stackwise_num_filters=[64, 64, 64],
stackwise_num_blocks=[2, 2, 2],
stackwise_num_strides=[1, 2, 2],
block_type="basic_block",
use_pre_activation=True,
)
model(input_data)
# Use resnet for image classification task
model = keras_hub.models.ImageClassifier.from_preset("hf://keras/resnet_v2_50_imagenet")
# User timm presets directly from hugingface
model = keras_hub.models.ImageClassifier.from_preset('hf://timm/resnetv2_101.a1h_in1k')