class_docstr: An anchor-based head used in `RetinaNet
  <https://arxiv.org/pdf/1708.02002.pdf>`_.
  
  The head contains two subnetworks. The first classifies anchor boxes and
  the second regresses deltas for the anchors.
  
  Example:
      >>> import torch
      >>> self = RetinaHead(11, 7)
      >>> x = torch.rand(1, 7, 32, 32)
      >>> cls_score, bbox_pred = self.forward_single(x)
      >>> # Each anchor predicts a score for each class except background
      >>> cls_per_anchor = cls_score.shape[1] / self.num_anchors
      >>> box_per_anchor = bbox_pred.shape[1] / self.num_anchors
      >>> assert cls_per_anchor == (self.num_classes)
      >>> assert box_per_anchor == 4
code: def __init__(
      self,
      num_classes,
      in_channels,
      stacked_convs=4,
      conv_cfg=None,
      norm_cfg=None,
      anchor_generator=dict(
          type="AnchorGenerator",
          octave_base_scale=4,
          scales_per_octave=3,
          ratios=[0.5, 1.0, 2.0],
          strides=[8, 16, 32, 64, 128],
      ),
      init_cfg=dict(
          type="Normal",
          layer="Conv2d",
          std=0.01,
          override=dict(
              type="Normal", name="retina_cls", std=0.01, bias_prob=0.01
          ),
      ),
      **kwargs,
  ):
      assert stacked_convs >= 0, (
          "`stacked_convs` must be non-negative integers, "
          f"but got {stacked_convs} instead."
      )
      self.stacked_convs = stacked_convs
      self.conv_cfg = conv_cfg
      self.norm_cfg = norm_cfg
      super(RetinaHead, self).__init__(
          num_classes,
          in_channels,
          anchor_generator=anchor_generator,
          init_cfg=init_cfg,
          **kwargs,
      )
  
file_path: mmdetection/mmdet/models/dense_heads/retina_head.py
imports: import torch.nn
  from mmcv.cnn import ConvModule
  from mmdet.registry import MODELS
  from .anchor_head import AnchorHead
label_desc: Use image node_id 1 to create a new RetinaHead object from inherited base classes: AnchorHead with example: obj = RetinaHead(num_classes, in_channels, stacked_convs, conv_cfg, norm_cfg, anchor_generator, init_cfg)