class_docstr: Pre-trained ResNetV1b Model, which produces the strides of 8 featuremaps at conv5.
  
  Parameters
  ----------
  block : Block
      Class for the residual block. Options are BasicBlockV1, BottleneckV1.
  layers : list of int
      Numbers of layers in each block
  classes : int, default 1000
      Number of classification classes.
  dilated : bool, default False
      Applying dilation strategy to pretrained ResNet yielding a stride-8 model,
      typically used in Semantic Segmentation.
  norm_layer : object
      Normalization layer used (default: :class:`nn.BatchNorm2d`)
  deep_stem : bool, default False
      Whether to replace the 7x7 conv1 with 3 3x3 convolution layers.
  avg_down : bool, default False
      Whether to use average pooling for projection skip connection between stages/downsample.
  final_drop : float, default 0.0
      Dropout ratio before the final classification layer.
  
  Reference:
      - He, Kaiming, et al. "Deep residual learning for image recognition."
      Proceedings of the IEEE conference on computer vision and pattern recognition. 2016.
  
      - Yu, Fisher, and Vladlen Koltun. "Multi-scale context aggregation by dilated convolutions."
class_docstr_tok: ["Pre-trained","ResNetV1b","Model",",","which","produces","the","strides","of","8","featuremaps","at","conv5",".","Parameters","--","--","--","--","--","block",":","Block","Class","for","the","residual","block",".","Options","are","BasicBlockV1",",","BottleneckV1",".","layers",":","list","of","int","Numbers","of","layers","in","each","block","classes",":","int",",","default","1000","Number","of","classification","classes",".","dilated",":","bool",",","default","False","Applying","dilation","strategy","to","pretrained","ResNet","yielding","a","stride-8","model",",","typically","used","in","Semantic","Segmentation",".","norm_layer",":","object","Normalization","layer","used","(","default",":",":","class",":","`","nn.BatchNorm2d","`",")","deep_stem",":","bool",",","default","False","Whether","to","replace","the","7x7","conv1","with","3","3x3","convolution","layers",".","avg_down",":","bool",",","default","False","Whether","to","use","average","pooling","for","projection","skip","connection","between","stages\/downsample",".","final_drop",":","float",",","default","0.0","Dropout","ratio","before","the","final","classification","layer",".","Reference",":","-","He",",","Kaiming",",","et","al",".","``","Deep","residual","learning","for","image","recognition",".","''","Proceedings","of","the","IEEE","conference","on","computer","vision","and","pattern","recognition",".","2016",".","-","Yu",",","Fisher",",","and","Vladlen","Koltun",".","``","Multi-scale","context","aggregation","by","dilated","convolutions",".","''"]
code: def __init__(
      self,
      block,
      layers,
      classes=1000,
      dilated=True,
      deep_stem=False,
      stem_width=32,
      avg_down=False,
      final_drop=0.0,
      norm_layer=nn.BatchNorm2d,
  ):
      self.inplanes = stem_width * 2 if deep_stem else 64
      super(ResNetV1b, self).__init__()
      if not deep_stem:
          self.conv1 = nn.Conv2d(
              3, 64, kernel_size=7, stride=2, padding=3, bias=False
          )
      else:
          self.conv1 = nn.Sequential(
              nn.Conv2d(
                  3,
                  stem_width,
                  kernel_size=3,
                  stride=2,
                  padding=1,
                  bias=False,
              ),
              norm_layer(stem_width),
              nn.ReLU(True),
              nn.Conv2d(
                  stem_width,
                  stem_width,
                  kernel_size=3,
                  stride=1,
                  padding=1,
                  bias=False,
              ),
              norm_layer(stem_width),
              nn.ReLU(True),
              nn.Conv2d(
                  stem_width,
                  2 * stem_width,
                  kernel_size=3,
                  stride=1,
                  padding=1,
                  bias=False,
              ),
          )
      self.bn1 = norm_layer(self.inplanes)
      self.relu = nn.ReLU(True)
      self.maxpool = nn.MaxPool2d(3, stride=2, padding=1)
      self.layer1 = self._make_layer(
          block, 64, layers[0], avg_down=avg_down, norm_layer=norm_layer
      )
      self.layer2 = self._make_layer(
          block,
          128,
          layers[1],
          stride=2,
          avg_down=avg_down,
          norm_layer=norm_layer,
      )
      if dilated:
          self.layer3 = self._make_layer(
              block,
              256,
              layers[2],
              stride=1,
              dilation=2,
              avg_down=avg_down,
              norm_layer=norm_layer,
          )
          self.layer4 = self._make_layer(
              block,
              512,
              layers[3],
              stride=1,
              dilation=4,
              avg_down=avg_down,
              norm_layer=norm_layer,
          )
      else:
          self.layer3 = self._make_layer(
              block,
              256,
              layers[2],
              stride=2,
              avg_down=avg_down,
              norm_layer=norm_layer,
          )
          self.layer4 = self._make_layer(
              block,
              512,
              layers[3],
              stride=2,
              avg_down=avg_down,
              norm_layer=norm_layer,
          )
      self.avgpool = nn.AdaptiveAvgPool2d((1, 1))
      self.drop = None
      if final_drop > 0.0:
          self.drop = nn.Dropout(final_drop)
      self.fc = nn.Linear(512 * block.expansion, classes)
  
file_path: carefree-learn/cflearn/api/cv/third_party/iharm/model/modeling/resnetv1b.py
imports: import torch
  import torch.nn
label_desc: Use image node_id 1 to create a new ResNetV1b object from inherited base classes: nn with example: obj = ResNetV1b(block, layers, classes, dilated, deep_stem, stem_width, avg_down, final_drop, norm_layer)