ResNet is a type of convolutional neural network (CNN) that is commonly used for image classification tasks. ResNet is a fully convolutional network that consists of a series of convolutional layers and pooling layers. The pooling layers are used to downsample the input while the convolutional layers are used to upsample the input. The skip connections between the pooling layers and convolutional layers allow ResNet to preserve spatial/temporal information while also allowing for faster training and inference times.
For more info, refer to the original paper Deep Residual Learning for Image Recognition .
Parameters are in helia_edge.models.resnet_params.
Functions
Name
Description
build
ResNet model from ResNetParams
generate_bottleneck_block
Generate functional bottleneck block
generate_residual_block
Generate functional residual block
resnet_layer
Generate functional ResNet model
Enable 1D and 2D variants.
Machine-readable model
generate_bottleneck_block(
kernel_size: int | tuple[ int , int ] = 3 ,
strides: int | tuple[ int , int ] = 1 ,
activation: str = 'relu6' ,
Generate functional bottleneck block.
Parameters
Parameters of generate_bottleneck_block Name Type Default Description filtersintRequired Filter size kernel_sizeint | tuple[int, int]3 Kernel size. Defaults to 3. stridesint | tuple[int, int]1 Stride length. Defaults to 1. expansionint4 Expansion factor. Defaults to 4.
Returns
Returns of generate_bottleneck_block Type Description keras.Layerkeras.Layer: TF functional layer
kernel_size: int | tuple[ int , int ] = 3 ,
strides: int | tuple[ int , int ] = 1 ,
activation: str = 'relu6' ,
Generate functional residual block
Parameters
Parameters of generate_residual_block Name Type Default Description filtersintRequired Filter size kernel_sizeint | tuple[int, int]3 Kernel size. Defaults to 3. stridesint | tuple[int, int]1 Stride length. Defaults to 1.
Returns
Returns of generate_residual_block Type Description keras.Layerkeras.Layer: TF functional layer
resnet_layer(x: keras.KerasTensor, params: ResNetParams) -> keras.KerasTensor
Generate functional ResNet model.
Args:
x (keras.KerasTensor): Inputs
params (ResNetParams): Model parameters.
Returns
Returns of resnet_layer Type Description keras.KerasTensorkeras.KerasTensor: Output tensor
input_shape: tuple[ int | None , ... ],
batch_size: int | None = None ,
Build a ResNet model.
Parameters
Parameters of build Name Type Default Description paramsResNetParamsRequired Model parameters. input_shapetuple[int | None, ...]Required Input shape without the batch axis; None for a variable axis. batch_sizeint | NoneNone Static batch size; None for a dynamic batch. namestr | NoneNone Model name; the family when None.
Returns
Returns of build Type Description keras.Modelkeras.Model: The model, named ``resnet`` unless ``name`` is given.