class_docstr: Base class for single-stage detectors.
  
  Single-stage detectors directly and densely predict bounding boxes on the
  output features of the backbone+neck.
class_docstr_tok: ["Base","class","for","single-stage","detectors",".","Single-stage","detectors","directly","and","densely","predict","bounding","boxes","on","the","output","features","of","the","backbone+neck","."]
docstr: Calculate losses from a batch of inputs and data samples.
  
  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: ["Calculate","losses","from","a","batch","of","inputs","and","data","samples",".","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
  ) -> Union[dict, list]:
      """Calculate losses from a batch of inputs and data samples.
  
      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 = self.bbox_head.loss(x, batch_data_samples)
      return losses
  
file_path: mmdetection/mmdet/models/detectors/single_stage.py
imports: from typing import List, Tuple, Union
  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 3 for calling the SingleStageDetector obj's underlying member method code with example usage: obj.loss(batch_inputs, batch_data_samples) and returns: losses