class_docstr: Path Aggregation Network for Instance Segmentation.
  
  This is an implementation of the `PAFPN in Path Aggregation Network
  <https://arxiv.org/abs/1803.01534>`_.
  
  Args:
      in_channels (List[int]): Number of input channels per scale.
      out_channels (int): Number of output channels (used at each scale)
      num_outs (int): Number of output scales.
      start_level (int): Index of the start input backbone level used to
          build the feature pyramid. Default: 0.
      end_level (int): Index of the end input backbone level (exclusive) to
          build the feature pyramid. Default: -1, which means the last level.
      add_extra_convs (bool | str): If bool, it decides whether to add conv
          layers on top of the original feature maps. Default to False.
          If True, it is equivalent to `add_extra_convs='on_input'`.
          If str, it specifies the source feature map of the extra convs.
          Only the following options are allowed
  
          - 'on_input': Last feat map of neck inputs (i.e. backbone feature).
          - 'on_lateral':  Last feature map after lateral convs.
          - 'on_output': The last output feature map after fpn convs.
      relu_before_extra_convs (bool): Whether to apply relu before the extra
          conv. Default: False.
      no_norm_on_lateral (bool): Whether to apply norm on lateral.
          Default: False.
      conv_cfg (dict): Config dict for convolution layer. Default: None.
      norm_cfg (dict): Config dict for normalization layer. Default: None.
      act_cfg (str): Config dict for activation layer in ConvModule.
          Default: None.
      init_cfg (dict or list[dict], optional): Initialization config dict.
code: def __init__(
      self,
      in_channels,
      out_channels,
      num_outs,
      start_level=0,
      end_level=-1,
      add_extra_convs=False,
      relu_before_extra_convs=False,
      no_norm_on_lateral=False,
      conv_cfg=None,
      norm_cfg=None,
      act_cfg=None,
      init_cfg=dict(
          type="Xavier", layer="Conv2d", distribution="uniform"
      ),
  ):
      super(PAFPN, self).__init__(
          in_channels,
          out_channels,
          num_outs,
          start_level,
          end_level,
          add_extra_convs,
          relu_before_extra_convs,
          no_norm_on_lateral,
          conv_cfg,
          norm_cfg,
          act_cfg,
          init_cfg=init_cfg,
      )
      # add extra bottom up pathway
      self.downsample_convs = nn.ModuleList()
      self.pafpn_convs = nn.ModuleList()
      for i in range(self.start_level + 1, self.backbone_end_level):
          d_conv = ConvModule(
              out_channels,
              out_channels,
              3,
              stride=2,
              padding=1,
              conv_cfg=conv_cfg,
              norm_cfg=norm_cfg,
              act_cfg=act_cfg,
              inplace=False,
          )
          pafpn_conv = ConvModule(
              out_channels,
              out_channels,
              3,
              padding=1,
              conv_cfg=conv_cfg,
              norm_cfg=norm_cfg,
              act_cfg=act_cfg,
              inplace=False,
          )
          self.downsample_convs.append(d_conv)
          self.pafpn_convs.append(pafpn_conv)
  
file_path: mmdetection/mmdet/models/necks/pafpn.py
imports: import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule
  from mmdet.registry import MODELS
  from .fpn import FPN
label_desc: Use image node_id 1 to create a new PAFPN object from inherited base classes: FPN with example: obj = PAFPN(in_channels, out_channels, num_outs, start_level, end_level, add_extra_convs, relu_before_extra_convs, no_norm_on_lateral, conv_cfg, norm_cfg, act_cfg, init_cfg)