class_docstr: RepLKNet model
  
  Args:
      large_kernel_sizes `tuple or list`: large kernel sizes
      layers (`tuple or list`): number of blocks at different stages
      channels (`tuple or list`): dimensions used at different stages
      drop_rate (`float`): drop rate used for stochastic depth
      small_kernel (`int`): the small kernel size
      dw_ratio (`int`): times of dim over input dim in depthwise conv
      ffn_ratio (`int`): times of internal dim over input dim in conv FFN
      in_channels (`int`): input dimension
      num_classes (`int`): number of classes for linear projection at the end
      out_indices (`tuple or list`): layer indices to return outputs
      small_kernel_merged (`bool`): flag to merge small kernels in ReparamLargeKernelConv
      norm_intermediate_features (`bool`): flag to return normalized features for downstream tasks
      deep_fuse (`bool`): flag to manually fuse BN
class_docstr_tok: ["RepLKNet","model","Args",":","large_kernel_sizes","`","tuple","or","list","`",":","large","kernel","sizes","layers","(","`","tuple","or","list","`",")",":","number","of","blocks","at","different","stages","channels","(","`","tuple","or","list","`",")",":","dimensions","used","at","different","stages","drop_rate","(","`","float","`",")",":","drop","rate","used","for","stochastic","depth","small_kernel","(","`","int","`",")",":","the","small","kernel","size","dw_ratio","(","`","int","`",")",":","times","of","dim","over","input","dim","in","depthwise","conv","ffn_ratio","(","`","int","`",")",":","times","of","internal","dim","over","input","dim","in","conv","FFN","in_channels","(","`","int","`",")",":","input","dimension","num_classes","(","`","int","`",")",":","number","of","classes","for","linear","projection","at","the","end","out_indices","(","`","tuple","or","list","`",")",":","layer","indices","to","return","outputs","small_kernel_merged","(","`","bool","`",")",":","flag","to","merge","small","kernels","in","ReparamLargeKernelConv","norm_intermediate_features","(","`","bool","`",")",":","flag","to","return","normalized","features","for","downstream","tasks","deep_fuse","(","`","bool","`",")",":","flag","to","manually","fuse","BN"]
code: def __init__(
      self,
      large_kernel_sizes,
      layers,
      channels,
      drop_rate,
      small_kernel,
      dw_ratio=1,
      ffn_ratio=4,
      in_channels=3,
      num_classes=1000,
      out_indices=None,
      small_kernel_merged=False,
      norm_intermediate_features=False,
      deep_fuse=True,
  ):
      super().__init__()
      self.large_kernel_sizes = large_kernel_sizes
      self.layers = layers
      self.channels = channels
      self.num_classes = num_classes
      self.small_kernel = small_kernel
      self.dw_ratio = dw_ratio
      self.deep_fuse = deep_fuse
  
      if num_classes is None and out_indices is None:
          raise ValueError(
              "must specify one of num_classes (for pretraining) and out_indices (for downstream tasks)"
          )
      elif num_classes is not None and out_indices is not None:
          raise ValueError(
              "cannot specify both num_classes (for pretraining) and out_indices (for downstream tasks)"
          )
      elif num_classes is not None and norm_intermediate_features:
          raise ValueError(
              "for pretraining, no need to normalize the intermediate feature maps"
          )
      self.out_indices = out_indices
  
      base_width = channels[0]
      self.norm_intermediate_features = norm_intermediate_features
      self.num_stages = len(layers)
      self.stem = nn.ModuleList(
          [
              conv_bn_relu(
                  in_channels=in_channels,
                  out_channels=base_width,
                  kernel_size=3,
                  stride=2,
                  padding=1,
                  groups=1,
              ),
              conv_bn_relu(
                  in_channels=base_width,
                  out_channels=base_width,
                  kernel_size=3,
                  stride=1,
                  padding=1,
                  groups=base_width,
              ),
              conv_bn_relu(
                  in_channels=base_width,
                  out_channels=base_width,
                  kernel_size=1,
                  stride=2,
                  padding=0,
                  groups=1,
              ),
              conv_bn_relu(
                  in_channels=base_width,
                  out_channels=base_width,
                  kernel_size=3,
                  stride=2,
                  padding=1,
                  groups=base_width,
              ),
          ]
      )
  
      # Stochastic depth. Set block-wise drop-path rate.
      # The higher level blocks are more likely to be dropped. This implementation follows Swin.
      dpr = [
          x.item() for x in torch.linspace(0, drop_rate, sum(layers))
      ]
      self.stages = nn.ModuleList()
      self.transitions = nn.ModuleList()
      for stage_idx in range(self.num_stages):
          layer = RepLKNetStage(
              channels=channels[stage_idx],
              num_blocks=layers[stage_idx],
              stage_lk_size=large_kernel_sizes[stage_idx],
              drop_rate=dpr[
                  sum(layers[:stage_idx]) : sum(layers[: stage_idx + 1])
              ],
              small_kernel=small_kernel,
              dw_ratio=dw_ratio,
              ffn_ratio=ffn_ratio,
              small_kernel_merged=small_kernel_merged,
              norm_intermediate_features=norm_intermediate_features,
          )
          self.stages.append(layer)
          if stage_idx < len(layers) - 1:
              transition = nn.Sequential(
                  conv_bn_relu(
                      in_channels=channels[stage_idx],
                      out_channels=channels[stage_idx + 1],
                      kernel_size=1,
                      stride=1,
                      padding=0,
                      groups=1,
                  ),
                  conv_bn_relu(
                      in_channels=channels[stage_idx + 1],
                      out_channels=channels[stage_idx + 1],
                      kernel_size=3,
                      stride=2,
                      padding=1,
                      groups=channels[stage_idx + 1],
                  ),
              )
              self.transitions.append(transition)
  
      if num_classes is not None:
          self.norm = nn.BatchNorm2d(channels[-1])
          self.avgpool = nn.AdaptiveAvgPool2d(1)
          self.head = nn.Linear(channels[-1], num_classes)
  
file_path: towhee/towhee/models/replknet/replknet.py
imports: import torch
  from torch import nn
  from towhee.models.utils import create_model
  from towhee.models.replknet import RepLKNetStage, fuse_bn, conv_bn_relu, get_configs
label_desc: Use image node_id 1 to create a new RepLKNet object from inherited base classes: nn with example: obj = RepLKNet(large_kernel_sizes, layers, channels, drop_rate, small_kernel, dw_ratio, ffn_ratio, in_channels, num_classes, out_indices, small_kernel_merged, norm_intermediate_features, deep_fuse)