class_docstr: YOLACT mask head used in https://arxiv.org/abs/1904.02689.
  
  This head outputs the mask prototypes for YOLACT.
  
  Args:
      in_channels (int): Number of channels in the input feature map.
      proto_channels (tuple[int]): Output channels of protonet convs.
      proto_kernel_sizes (tuple[int]): Kernel sizes of protonet convs.
      include_last_relu (Bool): If keep the last relu of protonet.
      num_protos (int): Number of prototypes.
      num_classes (int): Number of categories excluding the background
          category.
      loss_mask_weight (float): Reweight the mask loss by this factor.
      max_masks_to_train (int): Maximum number of masks to train for
          each image.
docstr: Resize, binarize, and format the instance mask predictions.
  
  Args:
      mask_pred (Tensor): shape (N, H, W).
      label_pred (Tensor): shape (N, ).
      img_meta (dict): Meta information of each image, e.g.,
          image size, scaling factor, etc.
      rescale (bool): If rescale is False, then returned masks will
          fit the scale of imgs[0].
  Returns:
      list[ndarray]: Mask predictions grouped by their predicted classes.
docstr_tok: ["Resize",",","binarize",",","and","format","the","instance","mask","predictions",".","Args",":","mask_pred","(","Tensor",")",":","shape","(","N",",","H",",","W",")",".","label_pred","(","Tensor",")",":","shape","(","N",",",")",".","img_meta","(","dict",")",":","Meta","information","of","each","image",",","e.g.",",","image","size",",","scaling","factor",",","etc",".","rescale","(","bool",")",":","If","rescale","is","False",",","then","returned","masks","will","fit","the","scale","of","imgs","[","0","]",".","Returns",":","list","[","ndarray","]",":","Mask","predictions","grouped","by","their","predicted","classes","."]
code: def get_seg_masks(self, mask_pred, label_pred, img_meta, rescale):
      """Resize, binarize, and format the instance mask predictions.
  
      Args:
          mask_pred (Tensor): shape (N, H, W).
          label_pred (Tensor): shape (N, ).
          img_meta (dict): Meta information of each image, e.g.,
              image size, scaling factor, etc.
          rescale (bool): If rescale is False, then returned masks will
              fit the scale of imgs[0].
      Returns:
          list[ndarray]: Mask predictions grouped by their predicted classes.
      """
      ori_shape = img_meta["ori_shape"]
      scale_factor = img_meta["scale_factor"]
      if rescale:
          img_h, img_w = ori_shape[:2]
      else:
          img_h = np.round(ori_shape[0] * scale_factor[1]).astype(
              np.int32
          )
          img_w = np.round(ori_shape[1] * scale_factor[0]).astype(
              np.int32
          )
  
      cls_segms = [[] for _ in range(self.num_classes)]
      if mask_pred.size(0) == 0:
          return cls_segms
  
      mask_pred = (
          F.interpolate(
              mask_pred.unsqueeze(0),
              (img_h, img_w),
              mode="bilinear",
              align_corners=False,
          ).squeeze(0)
          > 0.5
      )
      mask_pred = mask_pred.cpu().numpy().astype(np.uint8)
  
      for m, l in zip(mask_pred, label_pred):
          cls_segms[l].append(m)
      return cls_segms
  
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 YOLACTProtonet obj's underlying member method code with example usage: obj.get_seg_masks(mask_pred, label_pred, img_meta, rescale) and returns: cls_segms, cls_segms