class_docstr: Detection Head of RTMDet-Ins with sep-bn layers.
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      share_conv (bool): Whether to share conv layers between stages.
          Defaults to True.
      norm_cfg (:obj:`ConfigDict` or dict)): Config dict for normalization
          layer. Defaults to dict(type='BN').
      act_cfg (:obj:`ConfigDict` or dict)): Config dict for activation layer.
          Defaults to dict(type='SiLU', inplace=True).
      pred_kernel_size (int): Kernel size of prediction layer. Defaults to 1.
docstr: Initialize layers of the head.
code: def _init_layers(self) -> None:
      """Initialize layers of the head."""
      self.cls_convs = nn.ModuleList()
      self.reg_convs = nn.ModuleList()
      self.kernel_convs = nn.ModuleList()
  
      self.rtm_cls = nn.ModuleList()
      self.rtm_reg = nn.ModuleList()
      self.rtm_kernel = nn.ModuleList()
      self.rtm_obj = nn.ModuleList()
  
      # calculate num dynamic parameters
      weight_nums, bias_nums = [], []
      for i in range(self.num_dyconvs):
          if i == 0:
              weight_nums.append(
                  (self.num_prototypes + 2) * self.dyconv_channels
              )
              bias_nums.append(self.dyconv_channels)
          elif i == self.num_dyconvs - 1:
              weight_nums.append(self.dyconv_channels)
              bias_nums.append(1)
          else:
              weight_nums.append(
                  self.dyconv_channels * self.dyconv_channels
              )
              bias_nums.append(self.dyconv_channels)
      self.weight_nums = weight_nums
      self.bias_nums = bias_nums
      self.num_gen_params = sum(weight_nums) + sum(bias_nums)
      pred_pad_size = self.pred_kernel_size // 2
  
      for n in range(len(self.prior_generator.strides)):
          cls_convs = nn.ModuleList()
          reg_convs = nn.ModuleList()
          kernel_convs = nn.ModuleList()
          for i in range(self.stacked_convs):
              chn = self.in_channels if i == 0 else self.feat_channels
              cls_convs.append(
                  ConvModule(
                      chn,
                      self.feat_channels,
                      3,
                      stride=1,
                      padding=1,
                      conv_cfg=self.conv_cfg,
                      norm_cfg=self.norm_cfg,
                      act_cfg=self.act_cfg,
                  )
              )
              reg_convs.append(
                  ConvModule(
                      chn,
                      self.feat_channels,
                      3,
                      stride=1,
                      padding=1,
                      conv_cfg=self.conv_cfg,
                      norm_cfg=self.norm_cfg,
                      act_cfg=self.act_cfg,
                  )
              )
              kernel_convs.append(
                  ConvModule(
                      chn,
                      self.feat_channels,
                      3,
                      stride=1,
                      padding=1,
                      conv_cfg=self.conv_cfg,
                      norm_cfg=self.norm_cfg,
                      act_cfg=self.act_cfg,
                  )
              )
          self.cls_convs.append(cls_convs)
          self.reg_convs.append(cls_convs)
          self.kernel_convs.append(kernel_convs)
  
          self.rtm_cls.append(
              nn.Conv2d(
                  self.feat_channels,
                  self.num_base_priors * self.cls_out_channels,
                  self.pred_kernel_size,
                  padding=pred_pad_size,
              )
          )
          self.rtm_reg.append(
              nn.Conv2d(
                  self.feat_channels,
                  self.num_base_priors * 4,
                  self.pred_kernel_size,
                  padding=pred_pad_size,
              )
          )
          self.rtm_kernel.append(
              nn.Conv2d(
                  self.feat_channels,
                  self.num_gen_params,
                  self.pred_kernel_size,
                  padding=pred_pad_size,
              )
          )
          if self.with_objectness:
              self.rtm_obj.append(
                  nn.Conv2d(
                      self.feat_channels,
                      1,
                      self.pred_kernel_size,
                      padding=pred_pad_size,
                  )
              )
  
      if self.share_conv:
          for n in range(len(self.prior_generator.strides)):
              for i in range(self.stacked_convs):
                  self.cls_convs[n][i].conv = self.cls_convs[0][i].conv
                  self.reg_convs[n][i].conv = self.reg_convs[0][i].conv
  
      self.mask_head = MaskFeatModule(
          in_channels=self.in_channels,
          feat_channels=self.feat_channels,
          stacked_convs=4,
          num_levels=len(self.prior_generator.strides),
          num_prototypes=self.num_prototypes,
          act_cfg=self.act_cfg,
          norm_cfg=self.norm_cfg,
      )
  
imports: import copy
  import math
  from typing import List, Optional, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, is_norm
  from mmcv.ops import batched_nms
  from mmengine.model import BaseModule, bias_init_with_prob, constant_init, normal_init
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.models.layers.transformer import inverse_sigmoid
  from mmdet.models.utils import filter_scores_and_topk, multi_apply, select_single_mlvl, sigmoid_geometric_mean
  from mmdet.registry import MODELS
  from mmdet.structures.bbox import cat_boxes, distance2bbox, get_box_tensor, get_box_wh, scale_boxes
  from mmdet.utils import ConfigType, InstanceList, OptInstanceList, reduce_mean
  from .rtmdet_head import RTMDetHead
label_desc: Use image node_id 2 for calling the RTMDetInsSepBNHead obj's underlying member method code with example usage: obj._init_layers() without return types