class_docstr: Base class for single-stage instance segmentors.
class_docstr_tok: ["Base","class","for","single-stage","instance","segmentors","."]
docstr: Perform forward propagation of the mask head and predict mask
  results on the features of the upstream network.
  
  Args:
      batch_inputs (Tensor): Inputs with shape (N, C, H, W).
      batch_data_samples (List[:obj:`DetDataSample`]): The Data
          Samples. It usually includes information such as
          `gt_instance`, `gt_panoptic_seg` and `gt_sem_seg`.
      rescale (bool): Whether to rescale the results.
          Defaults to False.
  
  Returns:
      list[:obj:`DetDataSample`]: Detection results of the
      input images. Each DetDataSample usually contain
      'pred_instances'. And the ``pred_instances`` usually
      contains following keys.
  
      - scores (Tensor): Classification scores, has a shape
          (num_instance, )
      - labels (Tensor): Labels of bboxes, has a shape
          (num_instances, ).
      - bboxes (Tensor): Has a shape (num_instances, 4),
          the last dimension 4 arrange as (x1, y1, x2, y2).
      - masks (Tensor): Has a shape (num_instances, H, W).
docstr_tok: ["Perform","forward","propagation","of","the","mask","head","and","predict","mask","results","on","the","features","of","the","upstream","network",".","Args",":","batch_inputs","(","Tensor",")",":","Inputs","with","shape","(","N",",","C",",","H",",","W",")",".","batch_data_samples","(","List","[",":","obj",":","`","DetDataSample","`","]",")",":","The","Data","Samples",".","It","usually","includes","information","such","as","`","gt_instance","`",",","`","gt_panoptic_seg","`","and","`","gt_sem_seg","`",".","rescale","(","bool",")",":","Whether","to","rescale","the","results",".","Defaults","to","False",".","Returns",":","list","[",":","obj",":","`","DetDataSample","`","]",":","Detection","results","of","the","input","images",".","Each","DetDataSample","usually","contain","'pred_instances","'",".","And","the","``","pred_instances","``","usually","contains","following","keys",".","-","scores","(","Tensor",")",":","Classification","scores",",","has","a","shape","(","num_instance",",",")","-","labels","(","Tensor",")",":","Labels","of","bboxes",",","has","a","shape","(","num_instances",",",")",".","-","bboxes","(","Tensor",")",":","Has","a","shape","(","num_instances",",","4",")",",","the","last","dimension","4","arrange","as","(","x1",",","y1",",","x2",",","y2",")",".","-","masks","(","Tensor",")",":","Has","a","shape","(","num_instances",",","H",",","W",")","."]
code: def predict(
      self,
      batch_inputs: Tensor,
      batch_data_samples: SampleList,
      rescale: bool = True,
      **kwargs,
  ) -> SampleList:
      """Perform forward propagation of the mask head and predict mask
      results on the features of the upstream network.
  
      Args:
          batch_inputs (Tensor): Inputs with shape (N, C, H, W).
          batch_data_samples (List[:obj:`DetDataSample`]): The Data
              Samples. It usually includes information such as
              `gt_instance`, `gt_panoptic_seg` and `gt_sem_seg`.
          rescale (bool): Whether to rescale the results.
              Defaults to False.
  
      Returns:
          list[:obj:`DetDataSample`]: Detection results of the
          input images. Each DetDataSample usually contain
          'pred_instances'. And the ``pred_instances`` usually
          contains following keys.
  
          - scores (Tensor): Classification scores, has a shape
              (num_instance, )
          - labels (Tensor): Labels of bboxes, has a shape
              (num_instances, ).
          - bboxes (Tensor): Has a shape (num_instances, 4),
              the last dimension 4 arrange as (x1, y1, x2, y2).
          - masks (Tensor): Has a shape (num_instances, H, W).
      """
      x = self.extract_feat(batch_inputs)
      if self.with_bbox:
          # the bbox branch does not need to be scaled to the original
          # image scale, because the mask branch will scale both bbox
          # and mask at the same time.
          bbox_rescale = rescale if not self.with_mask else False
          results_list = self.bbox_head.predict(
              x, batch_data_samples, rescale=bbox_rescale
          )
      else:
          results_list = None
  
      results_list = self.mask_head.predict(
          x,
          batch_data_samples,
          rescale=rescale,
          results_list=results_list,
      )
  
      batch_data_samples = self.add_pred_to_datasample(
          batch_data_samples, results_list
      )
      return batch_data_samples
  
file_path: mmdetection/mmdet/models/detectors/single_stage_instance_seg.py
imports: import copy
  from typing import Tuple
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import OptSampleList, SampleList
  from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig
  from .base import BaseDetector
label_desc: Use image node_id 5 for calling the SingleStageInstanceSegmentor obj's underlying member method code with example usage: obj.predict(batch_inputs, batch_data_samples, rescale) and returns: batch_data_samples