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.
docstr: "Similiar to func:``AnchorHead.get_bboxes``, but additionally
  processes coeff_preds.
  
  Args:
      cls_scores (list[Tensor]): Box scores for each scale level
          with shape (N, num_anchors * num_classes, H, W)
      bbox_preds (list[Tensor]): Box energies / deltas for each scale
          level with shape (N, num_anchors * 4, H, W)
      coeff_preds (list[Tensor]): Mask coefficients for each scale
          level with shape (N, num_anchors * num_protos, H, W)
      img_metas (list[dict]): Meta information of each image, e.g.,
          image size, scaling factor, etc.
      cfg (mmcv.Config | None): Test / postprocessing configuration,
          if None, test_cfg would be used
      rescale (bool): If True, return boxes in original image space.
          Default: False.
  
  Returns:
      list[tuple[Tensor, Tensor, Tensor]]: Each item in result_list is
          a 3-tuple. The first item is an (n, 5) tensor, where the
          first 4 columns are bounding box positions
          (tl_x, tl_y, br_x, br_y) and the 5-th column is a score
          between 0 and 1. The second item is an (n,) tensor where each
          item is the predicted class label of the corresponding box.
          The third item is an (n, num_protos) tensor where each item
          is the predicted mask coefficients of instance inside the
          corresponding box.
docstr_tok: ["``","Similiar","to","func",":","``","AnchorHead.get_bboxes","``",",","but","additionally","processes","coeff_preds",".","Args",":","cls_scores","(","list","[","Tensor","]",")",":","Box","scores","for","each","scale","level","with","shape","(","N",",","num_anchors","*","num_classes",",","H",",","W",")","bbox_preds","(","list","[","Tensor","]",")",":","Box","energies","\/","deltas","for","each","scale","level","with","shape","(","N",",","num_anchors","*","4",",","H",",","W",")","coeff_preds","(","list","[","Tensor","]",")",":","Mask","coefficients","for","each","scale","level","with","shape","(","N",",","num_anchors","*","num_protos",",","H",",","W",")","img_metas","(","list","[","dict","]",")",":","Meta","information","of","each","image",",","e.g.",",","image","size",",","scaling","factor",",","etc",".","cfg","(","mmcv.Config","|","None",")",":","Test","\/","postprocessing","configuration",",","if","None",",","test_cfg","would","be","used","rescale","(","bool",")",":","If","True",",","return","boxes","in","original","image","space",".","Default",":","False",".","Returns",":","list","[","tuple","[","Tensor",",","Tensor",",","Tensor","]","]",":","Each","item","in","result_list","is","a","3-tuple",".","The","first","item","is","an","(","n",",","5",")","tensor",",","where","the","first","4","columns","are","bounding","box","positions","(","tl_x",",","tl_y",",","br_x",",","br_y",")","and","the","5-th","column","is","a","score","between","0","and","1",".","The","second","item","is","an","(","n",",",")","tensor","where","each","item","is","the","predicted","class","label","of","the","corresponding","box",".","The","third","item","is","an","(","n",",","num_protos",")","tensor","where","each","item","is","the","predicted","mask","coefficients","of","instance","inside","the","corresponding","box","."]
code: def get_bboxes(
      self,
      cls_scores,
      bbox_preds,
      coeff_preds,
      img_metas,
      cfg=None,
      rescale=False,
  ):
      """ "Similiar to func:``AnchorHead.get_bboxes``, but additionally
      processes coeff_preds.
  
      Args:
          cls_scores (list[Tensor]): Box scores for each scale level
              with shape (N, num_anchors * num_classes, H, W)
          bbox_preds (list[Tensor]): Box energies / deltas for each scale
              level with shape (N, num_anchors * 4, H, W)
          coeff_preds (list[Tensor]): Mask coefficients for each scale
              level with shape (N, num_anchors * num_protos, H, W)
          img_metas (list[dict]): Meta information of each image, e.g.,
              image size, scaling factor, etc.
          cfg (mmcv.Config | None): Test / postprocessing configuration,
              if None, test_cfg would be used
          rescale (bool): If True, return boxes in original image space.
              Default: False.
  
      Returns:
          list[tuple[Tensor, Tensor, Tensor]]: Each item in result_list is
              a 3-tuple. The first item is an (n, 5) tensor, where the
              first 4 columns are bounding box positions
              (tl_x, tl_y, br_x, br_y) and the 5-th column is a score
              between 0 and 1. The second item is an (n,) tensor where each
              item is the predicted class label of the corresponding box.
              The third item is an (n, num_protos) tensor where each item
              is the predicted mask coefficients of instance inside the
              corresponding box.
      """
      assert len(cls_scores) == len(bbox_preds)
      num_levels = len(cls_scores)
  
      device = cls_scores[0].device
      featmap_sizes = [
          cls_scores[i].shape[-2:] for i in range(num_levels)
      ]
      mlvl_anchors = self.anchor_generator.grid_anchors(
          featmap_sizes, device=device
      )
  
      det_bboxes = []
      det_labels = []
      det_coeffs = []
      for img_id in range(len(img_metas)):
          cls_score_list = [
              cls_scores[i][img_id].detach() for i in range(num_levels)
          ]
          bbox_pred_list = [
              bbox_preds[i][img_id].detach() for i in range(num_levels)
          ]
          coeff_pred_list = [
              coeff_preds[i][img_id].detach() for i in range(num_levels)
          ]
          img_shape = img_metas[img_id]["img_shape"]
          scale_factor = img_metas[img_id]["scale_factor"]
          bbox_res = self._get_bboxes_single(
              cls_score_list,
              bbox_pred_list,
              coeff_pred_list,
              mlvl_anchors,
              img_shape,
              scale_factor,
              cfg,
              rescale,
          )
          det_bboxes.append(bbox_res[0])
          det_labels.append(bbox_res[1])
          det_coeffs.append(bbox_res[2])
      return det_bboxes, det_labels, det_coeffs
  
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 7 for calling the YOLACTHead obj's underlying member method code with example usage: obj.get_bboxes(cls_scores, bbox_preds, coeff_preds, img_metas, cfg, rescale) and returns: det_bboxes,  det_labels,  det_coeffs