class_docstr: Base class for single-stage instance segmentors.
class_docstr_tok: ["Base","class","for","single-stage","instance","segmentors","."]
docstr: Args:
      batch_inputs (Tensor): Input images of shape (N, C, H, W).
          These should usually be mean centered and std scaled.
      batch_data_samples (list[:obj:`DetDataSample`]): The batch
          data samples. It usually includes information such
          as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`.
  
  Returns:
      dict: A dictionary of loss components.
docstr_tok: ["Args",":","batch_inputs","(","Tensor",")",":","Input","images","of","shape","(","N",",","C",",","H",",","W",")",".","These","should","usually","be","mean","centered","and","std","scaled",".","batch_data_samples","(","list","[",":","obj",":","`","DetDataSample","`","]",")",":","The","batch","data","samples",".","It","usually","includes","information","such","as","`","gt_instance","`","or","`","gt_panoptic_seg","`","or","`","gt_sem_seg","`",".","Returns",":","dict",":","A","dictionary","of","loss","components","."]
code: def loss(
      self,
      batch_inputs: Tensor,
      batch_data_samples: SampleList,
      **kwargs,
  ) -> dict:
      """
      Args:
          batch_inputs (Tensor): Input images of shape (N, C, H, W).
              These should usually be mean centered and std scaled.
          batch_data_samples (list[:obj:`DetDataSample`]): The batch
              data samples. It usually includes information such
              as `gt_instance` or `gt_panoptic_seg` or `gt_sem_seg`.
  
      Returns:
          dict: A dictionary of loss components.
      """
      x = self.extract_feat(batch_inputs)
      losses = dict()
  
      positive_infos = None
      # CondInst and YOLACT have bbox_head
      if self.with_bbox:
          bbox_losses = self.bbox_head.loss(
              x, batch_data_samples, **kwargs
          )
          losses.update(bbox_losses)
          # get positive information from bbox head, which will be used
          # in the following mask head.
          positive_infos = self.bbox_head.get_positive_infos()
  
      mask_loss = self.mask_head.loss(
          x, batch_data_samples, positive_infos=positive_infos, **kwargs
      )
      # avoid loss override
      assert not set(mask_loss.keys()) & set(losses.keys())
  
      losses.update(mask_loss)
      return losses
  
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 4 for calling the SingleStageInstanceSegmentor obj's underlying member method code with example usage: obj.loss(batch_inputs, batch_data_samples) and returns: losses