class_docstr: CSPDarkNet backbone.
  Args:
      arch (str): Architecture of CSPDarkNet, from {P5, P6, X}, default as X,
          and 'X' means used in YOLOX, 'P5/P6' means used in YOLOv5.
      depth_mult (float): Depth multiplier, multiply number of channels in
          each layer, default as 1.0.
      width_mult (float): Width multiplier, multiply number of blocks in
          CSPLayer, default as 1.0.
      depthwise (bool): Whether to use depth-wise conv layer.
      act (str): Activation function type, default as 'silu'.
      return_idx (list): Index of stages whose feature maps are returned.
code: def __init__(
      self,
      arch="X",
      depth_mult=1.0,
      width_mult=1.0,
      depthwise=False,
      act="silu",
      trt=False,
      return_idx=[2, 3, 4],
  ):
      super(CSPDarkNet, self).__init__()
      self.arch = arch
      self.return_idx = return_idx
      Conv = DWConv if depthwise else BaseConv
      arch_setting = self.arch_settings[arch]
      base_channels = int(arch_setting[0][0] * width_mult)
  
      # Note: differences between the latest YOLOv5 and the original YOLOX
      # 1. self.stem, use SPPF(in YOLOv5) or SPP(in YOLOX)
      # 2. use SPPF(in YOLOv5) or SPP(in YOLOX)
      # 3. put SPPF before(YOLOv5) or SPP after(YOLOX) the last cspdark block's CSPLayer
      # 4. whether SPPF(SPP)'CSPLayer add shortcut, True in YOLOv5, False in YOLOX
      if arch in ["P5", "P6"]:
          # in the latest YOLOv5, use Conv stem, and SPPF (fast, only single spp kernal size)
          self.stem = Conv(
              3, base_channels, ksize=6, stride=2, bias=False, act=act
          )
          spp_kernal_sizes = 5
      elif arch in ["X"]:
          # in the original YOLOX, use Focus stem, and SPP (three spp kernal sizes)
          self.stem = Focus(
              3, base_channels, ksize=3, stride=1, bias=False, act=act
          )
          spp_kernal_sizes = (5, 9, 13)
      else:
          raise AttributeError("Unsupported arch type: {}".format(arch))
  
      _out_channels = [base_channels]
      layers_num = 1
      self.csp_dark_blocks = []
  
      for i, (
          in_channels,
          out_channels,
          num_blocks,
          shortcut,
          use_spp,
      ) in enumerate(arch_setting):
          in_channels = int(in_channels * width_mult)
          out_channels = int(out_channels * width_mult)
          _out_channels.append(out_channels)
          num_blocks = max(round(num_blocks * depth_mult), 1)
          stage = []
  
          conv_layer = self.add_sublayer(
              "layers{}.stage{}.conv_layer".format(layers_num, i + 1),
              Conv(
                  in_channels, out_channels, 3, 2, bias=False, act=act
              ),
          )
          stage.append(conv_layer)
          layers_num += 1
  
          if use_spp and arch in ["X"]:
              # in YOLOX use SPPLayer
              spp_layer = self.add_sublayer(
                  "layers{}.stage{}.spp_layer".format(
                      layers_num, i + 1
                  ),
                  SPPLayer(
                      out_channels,
                      out_channels,
                      kernel_sizes=spp_kernal_sizes,
                      bias=False,
                      act=act,
                  ),
              )
              stage.append(spp_layer)
              layers_num += 1
  
          csp_layer = self.add_sublayer(
              "layers{}.stage{}.csp_layer".format(layers_num, i + 1),
              CSPLayer(
                  out_channels,
                  out_channels,
                  num_blocks=num_blocks,
                  shortcut=shortcut,
                  depthwise=depthwise,
                  bias=False,
                  act=act,
              ),
          )
          stage.append(csp_layer)
          layers_num += 1
  
          if use_spp and arch in ["P5", "P6"]:
              # in latest YOLOv5 use SPPFLayer instead of SPPLayer
              sppf_layer = self.add_sublayer(
                  "layers{}.stage{}.sppf_layer".format(
                      layers_num, i + 1
                  ),
                  SPPFLayer(
                      out_channels,
                      out_channels,
                      ksize=5,
                      bias=False,
                      act=act,
                  ),
              )
              stage.append(sppf_layer)
              layers_num += 1
  
          self.csp_dark_blocks.append(nn.Sequential(*stage))
  
      self._out_channels = [_out_channels[i] for i in self.return_idx]
      self.strides = [[2, 4, 8, 16, 32, 64][i] for i in self.return_idx]
  
imports: import paddle
  import paddle.nn
  import paddle.nn.functional
  from paddle import ParamAttr
  from paddle.regularizer import L2Decay
  from ppdet.core.workspace import register, serializable
  from ppdet.modeling.initializer import conv_init_
  from ..shape_spec import ShapeSpec
label_desc: Use image node_id 1 to create a new CSPDarkNet object from inherited base classes: nn with example: obj = CSPDarkNet(arch, depth_mult, width_mult, depthwise, act, trt, return_idx)