Model Overview

Model Summary

Instantiates the ResNet architecture amended by “bag of tricks” modifications.

Reference

Bag of Tricks for Image Classification with Convolutional Neural Networks

ResNetVd introduces two key modifications to the standard ResNet. First, the initial convolutional layer is replaced by a series of three successive convolutional layers. Second, shortcut connections use an additional pooling operation rather than performing downsampling within the convolutional layers themselves.

Links

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: PaddleOCR. Full code examples for each are available below.

Preset name Parameters Description
resnet_vd_18_imagenet 11.72M 18-layer ResNetVD model pre-trained on the ImageNet 1k dataset at a 224x224 resolution.
resnet_vd_34_imagenet 21.84M 34-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution.
resnet_vd_50_imagenet 25.63M 50-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution.
resnet_vd_50_ssld_imagenet 25.63M 50-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution with knowledge distillation.
resnet_vd_50_ssld_v2_imagenet 25.63M 50-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution with knowledge distillation and AutoAugment.
resnet_vd_50_ssld_v2_fix_imagenet 25.63M 50-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution with knowledge distillation, AutoAugment and additional fine-tuning of the classification head.
resnet_vd_101_imagenet 44.67M 101-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution.
resnet_vd_101_ssld_imagenet 44.67M 101-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution with knowledge distillation.
resnet_vd_152_imagenet 60.36M 152-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution.
resnet_vd_200_imagenet 74.93M 200-layer ResNet model pre-trained on the ImageNet 1k dataset at a 224x224 resolution.

Example Usage

   
from keras_hub.models import ResNetBackbone
import keras
import numpy as np

input_data = np.ones(shape=(8, 224, 224, 3))

# Pretrained backbone
model = ResNetBackbone.from_preset("resnet_vd_34_imagenet")
output = model(input_data)

# Randomly initialized backbone with a custom config
model = ResNetBackbone(
        input_conv_filters=[32, 32, 64],
        input_conv_kernel_sizes=[3, 3, 3],
        stackwise_num_filters=[64, 128, 256, 512],
        stackwise_num_blocks=[3, 4, 5, 6],
        stackwise_num_strides=[1, 2, 2, 2],
        block_type="bottleneck_block_vd",
    )
output = model(input_data)

Example Usage with Hugging Face URI

   
from keras_hub.models import ResNetBackbone
import keras
import numpy as np

input_data = np.ones(shape=(8, 224, 224, 3))

# Pretrained backbone
model = ResNetBackbone.from_preset("hf://keras/resnet_vd_34_imagenet")
output = model(input_data)

# Randomly initialized backbone with a custom config
model = ResNetBackbone(
        input_conv_filters=[32, 32, 64],
        input_conv_kernel_sizes=[3, 3, 3],
        stackwise_num_filters=[64, 128, 256, 512],
        stackwise_num_blocks=[3, 4, 5, 6],
        stackwise_num_strides=[1, 2, 2, 2],
        block_type="bottleneck_block_vd",
    )
output = model(input_data)
Downloads last month
13
Inference Providers NEW
This model is not currently available via any of the supported Inference Providers.
The model cannot be deployed to the HF Inference API: The HF Inference API does not support image-classification models for keras-hub library.

Collection including keras/resnet_vd_34_imagenet