class_docstr: YOLACT box head used in https://arxiv.org/abs/1904.02689.
  
  Note that YOLACT head is a light version of RetinaNet head.
  Four differences are described as follows:
  
  1. YOLACT box head has three-times fewer anchors.
  2. YOLACT box head shares the convs for box and cls branches.
  3. YOLACT box head uses OHEM instead of Focal loss.
  4. YOLACT box head predicts a set of mask coefficients for each box.
  
  Args:
      num_classes (int): Number of categories excluding the background
          category.
      in_channels (int): Number of channels in the input feature map.
      anchor_generator (dict): Config dict for anchor generator
      loss_cls (dict): Config of classification loss.
      loss_bbox (dict): Config of localization loss.
      num_head_convs (int): Number of the conv layers shared by
          box and cls branches.
      num_protos (int): Number of the mask coefficients.
      use_ohem (bool): If true, ``loss_single_OHEM`` will be used for
          cls loss calculation. If false, ``loss_single`` will be used.
      conv_cfg (dict): Dictionary to construct and config conv layer.
      norm_cfg (dict): Dictionary to construct and config norm layer.
code: def __init__(
      self,
      num_classes,
      in_channels,
      anchor_generator=dict(
          type="AnchorGenerator",
          octave_base_scale=3,
          scales_per_octave=1,
          ratios=[0.5, 1.0, 2.0],
          strides=[8, 16, 32, 64, 128],
      ),
      loss_cls=dict(
          type="CrossEntropyLoss",
          use_sigmoid=False,
          reduction="none",
          loss_weight=1.0,
      ),
      loss_bbox=dict(type="SmoothL1Loss", beta=1.0, loss_weight=1.5),
      num_head_convs=1,
      num_protos=32,
      use_ohem=True,
      conv_cfg=None,
      norm_cfg=None,
      **kwargs,
  ):
      self.num_head_convs = num_head_convs
      self.num_protos = num_protos
      self.use_ohem = use_ohem
      self.conv_cfg = conv_cfg
      self.norm_cfg = norm_cfg
      super(YOLACTHead, self).__init__(
          num_classes,
          in_channels,
          loss_cls=loss_cls,
          loss_bbox=loss_bbox,
          anchor_generator=anchor_generator,
          **kwargs,
      )
      if self.use_ohem:
          sampler_cfg = dict(type="PseudoSampler")
          self.sampler = build_sampler(sampler_cfg, context=self)
          self.sampling = False
  
imports: import numpy
  import torch
  import torch.nn
  import torch.nn.functional
  from mmcv.cnn import ConvModule, xavier_init
  from mmcv.runner import force_fp32
  from mmdet.core import build_sampler, fast_nms, images_to_levels, multi_apply
  from ..builder import HEADS, build_loss
  from .anchor_head import AnchorHead
label_desc: Use image node_id 1 to create a new YOLACTHead object from inherited base classes: AnchorHead with example: obj = YOLACTHead(num_classes, in_channels, anchor_generator, loss_cls, loss_bbox, num_head_convs, num_protos, use_ohem, conv_cfg, norm_cfg)