class_docstr: YOLOV3Head Paper link: https://arxiv.org/abs/1804.02767.
  
  Args:
      num_classes (int): The number of object classes (w/o background)
      in_channels (Sequence[int]): Number of input channels per scale.
      out_channels (Sequence[int]): The number of output channels per scale
          before the final 1x1 layer. Default: (1024, 512, 256).
      anchor_generator (:obj:`ConfigDict` or dict): Config dict for anchor
          generator.
      bbox_coder (:obj:`ConfigDict` or dict): Config of bounding box coder.
      featmap_strides (Sequence[int]): The stride of each scale.
          Should be in descending order. Defaults to (32, 16, 8).
      one_hot_smoother (float): Set a non-zero value to enable label-smooth
          Defaults to 0.
      conv_cfg (:obj:`ConfigDict` or dict, optional): Config dict for
          convolution layer. Defaults to None.
      norm_cfg (:obj:`ConfigDict` or dict): Dictionary to construct and
          config norm layer. Defaults to dict(type='BN', requires_grad=True).
      act_cfg (:obj:`ConfigDict` or dict): Config dict for activation layer.
          Defaults to dict(type='LeakyReLU', negative_slope=0.1).
      loss_cls (:obj:`ConfigDict` or dict): Config of classification loss.
      loss_conf (:obj:`ConfigDict` or dict): Config of confidence loss.
      loss_xy (:obj:`ConfigDict` or dict): Config of xy coordinate loss.
      loss_wh (:obj:`ConfigDict` or dict): Config of wh coordinate loss.
      train_cfg (:obj:`ConfigDict` or dict, optional): Training config of
          YOLOV3 head. Defaults to None.
      test_cfg (:obj:`ConfigDict` or dict, optional): Testing config of
          YOLOV3 head. Defaults to None.
code: def __init__(
      self,
      num_classes: int,
      in_channels: Sequence[int],
      out_channels: Sequence[int] = (1024, 512, 256),
      anchor_generator: ConfigType = dict(
          type="YOLOAnchorGenerator",
          base_sizes=[
              [(116, 90), (156, 198), (373, 326)],
              [(30, 61), (62, 45), (59, 119)],
              [(10, 13), (16, 30), (33, 23)],
          ],
          strides=[32, 16, 8],
      ),
      bbox_coder: ConfigType = dict(type="YOLOBBoxCoder"),
      featmap_strides: Sequence[int] = (32, 16, 8),
      one_hot_smoother: float = 0.0,
      conv_cfg: OptConfigType = None,
      norm_cfg: ConfigType = dict(type="BN", requires_grad=True),
      act_cfg: ConfigType = dict(type="LeakyReLU", negative_slope=0.1),
      loss_cls: ConfigType = dict(
          type="CrossEntropyLoss", use_sigmoid=True, loss_weight=1.0
      ),
      loss_conf: ConfigType = dict(
          type="CrossEntropyLoss", use_sigmoid=True, loss_weight=1.0
      ),
      loss_xy: ConfigType = dict(
          type="CrossEntropyLoss", use_sigmoid=True, loss_weight=1.0
      ),
      loss_wh: ConfigType = dict(type="MSELoss", loss_weight=1.0),
      train_cfg: OptConfigType = None,
      test_cfg: OptConfigType = None,
  ) -> None:
      super().__init__(init_cfg=None)
      # Check params
      assert (
          len(in_channels) == len(out_channels) == len(featmap_strides)
      )
  
      self.num_classes = num_classes
      self.in_channels = in_channels
      self.out_channels = out_channels
      self.featmap_strides = featmap_strides
      self.train_cfg = train_cfg
      self.test_cfg = test_cfg
      if self.train_cfg:
          self.assigner = TASK_UTILS.build(self.train_cfg["assigner"])
          if train_cfg.get("sampler", None) is not None:
              self.sampler = TASK_UTILS.build(
                  self.train_cfg["sampler"], context=self
              )
          else:
              self.sampler = PseudoSampler()
  
      self.one_hot_smoother = one_hot_smoother
  
      self.conv_cfg = conv_cfg
      self.norm_cfg = norm_cfg
      self.act_cfg = act_cfg
  
      self.bbox_coder = TASK_UTILS.build(bbox_coder)
  
      self.prior_generator = TASK_UTILS.build(anchor_generator)
  
      self.loss_cls = MODELS.build(loss_cls)
      self.loss_conf = MODELS.build(loss_conf)
      self.loss_xy = MODELS.build(loss_xy)
      self.loss_wh = MODELS.build(loss_wh)
  
      self.num_base_priors = self.prior_generator.num_base_priors[0]
      assert len(self.prior_generator.num_base_priors) == len(
          featmap_strides
      )
      self._init_layers()
  
imports: import copy
  import warnings
  from typing import List, Optional, Sequence, Tuple
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, is_norm
  from mmengine.model import bias_init_with_prob, constant_init, normal_init
  from mmengine.structures import InstanceData
  from torch import Tensor
  from mmdet.registry import MODELS, TASK_UTILS
  from mmdet.utils import ConfigType, InstanceList, OptConfigType, OptInstanceList
  from ..task_modules.samplers import PseudoSampler
  from ..utils import filter_scores_and_topk, images_to_levels, multi_apply
  from .base_dense_head import BaseDenseHead
label_desc: Use image node_id 1 to create a new YOLOV3Head object from inherited base classes: BaseDenseHead with example: obj = YOLOV3Head(num_classes, in_channels, out_channels, anchor_generator, bbox_coder, featmap_strides, one_hot_smoother, conv_cfg, norm_cfg, act_cfg, loss_cls, loss_conf, loss_xy, loss_wh, train_cfg, test_cfg)