Skip to content

ResNet

ResNet backbone based on Deep Residual Learning for Image Recognition.

You can flexibly choose between basicblock and bottleneck as the building blocks for the ResNet architecture. And, you can also freely determine the number of stages and the repetition of blocks within the model. This flexibility supports the creation of various ResNet models, e.g. ResNet18, ResNet34, ResNet50, ResNet101, and ResNet152. Also this supports adjusting the number of stages and blocks for your specific requirements.

Compatibility matrix

Supporting necks Supporting heads torch.fx NetsPresso
FPN
YOLOPAFPN
FC
ALLMLPDecoder
AnchorDecoupledHead
AnchorFreeDecoupledHead
Supported Supported

Field list

Field Description
name (str) Name must be "resnet" to use ResNet backbone.
params.block_type (str) Key value that determines which block to use, "basicblock" or "bottleneck".
params.norm_type (str) Type of normalization layer. Supporting normalization layers are described in [here].
stage_params[n].channels (int) The dimension of the first convolution layer in each block.
stage_params[n].num_blocks (int) The number of blocks in the stage.
stage_params[n].replace_stride_with_dilation (bool) Flag that determines whether to replace stride step with dilated convolution.

Model configuration examples

ResNet18
model:
  architecture:
    backbone:
      name: resnet
      params:
        block: basicblock
        norm_layer: batch_norm
      stage_params:
        - 
          channels: 64
          layers: 2
        - 
          channels: 128
          layers: 2
          replace_stride_with_dilation: False
        - 
          channels: 256
          layers: 2
          replace_stride_with_dilation: False
        - 
          plane: 512
          layers: 2
          replace_stride_with_dilation: False
ResNet34
model:
  architecture:
    backbone:
      name: resnet
      params:
        block: basicblock
        norm_layer: batch_norm
      stage_params:
        - 
          plane: 64
          layers: 3
        - 
          plane: 128
          layers: 4
          replace_stride_with_dilation: False
        - 
          plane: 256
          layers: 6
          replace_stride_with_dilation: False
        - 
          plane: 512
          layers: 3
          replace_stride_with_dilation: False
ResNet50
model:
  architecture:
    backbone:
      name: resnet
      params:
        block: bottleneck
        norm_layer: batch_norm
      stage_params:
        - 
          plane: 64
          layers: 3
        - 
          plane: 128
          layers: 4
          replace_stride_with_dilation: False
        - 
          plane: 256
          layers: 6
          replace_stride_with_dilation: False
        - 
          plane: 512
          layers: 3
          replace_stride_with_dilation: False
ResNet101
model:
  architecture:
    backbone:
      name: resnet
      params:
        block: bottleneck
        norm_layer: batch_norm
      stage_params:
        - 
          plane: 64
          layers: 3
        - 
          plane: 128
          layers: 4
          replace_stride_with_dilation: False
        - 
          plane: 256
          layers: 23
          replace_stride_with_dilation: False
        - 
          plane: 512
          layers: 3
          replace_stride_with_dilation: False
ResNet152
model:
  architecture:
    backbone:
      name: resnet
      params:
        block: bottleneck
        norm_layer: batch_norm
      stage_params:
        - 
          plane: 64
          layers: 3
        - 
          plane: 128
          layers: 8
          replace_stride_with_dilation: False
        - 
          plane: 256
          layers: 36
          replace_stride_with_dilation: False
        - 
          plane: 512
          layers: 3
          replace_stride_with_dilation: False