class_docstr: Base class of Two-stage Panoptic Segmentor.
  
  As well as the components in TwoStageDetector, Panoptic Segmentor has extra
  semantic_head and panoptic_fusion_head.
class_docstr_tok: ["Base","class","of","Two-stage","Panoptic","Segmentor",".","As","well","as","the","components","in","TwoStageDetector",",","Panoptic","Segmentor","has","extra","semantic_head","and","panoptic_fusion_head","."]
docstr: Network forward process. Usually includes backbone, neck and head
  forward without any post-processing.
  
  Args:
      batch_inputs (Tensor): Inputs with shape (N, C, H, W).
  
  Returns:
      tuple: A tuple of features from ``rpn_head``, ``roi_head`` and
          ``semantic_head`` forward.
docstr_tok: ["Network","forward","process",".","Usually","includes","backbone",",","neck","and","head","forward","without","any","post-processing",".","Args",":","batch_inputs","(","Tensor",")",":","Inputs","with","shape","(","N",",","C",",","H",",","W",")",".","Returns",":","tuple",":","A","tuple","of","features","from","``","rpn_head","``",",","``","roi_head","``","and","``","semantic_head","``","forward","."]
code: def _forward(
      self, batch_inputs: Tensor, batch_data_samples: SampleList
  ) -> tuple:
      """Network forward process. Usually includes backbone, neck and head
      forward without any post-processing.
  
      Args:
          batch_inputs (Tensor): Inputs with shape (N, C, H, W).
  
      Returns:
          tuple: A tuple of features from ``rpn_head``, ``roi_head`` and
              ``semantic_head`` forward.
      """
      results = ()
      x = self.extract_feat(batch_inputs)
      rpn_outs = self.rpn_head.forward(x)
      results = results + (rpn_outs)
  
      # If there are no pre-defined proposals, use RPN to get proposals
      if batch_data_samples[0].get("proposals", None) is None:
          batch_img_metas = [
              data_samples.metainfo
              for data_samples in batch_data_samples
          ]
          rpn_results_list = self.rpn_head.predict_by_feat(
              *rpn_outs, batch_img_metas=batch_img_metas, rescale=False
          )
      else:
          # TODO: Not checked currently.
          rpn_results_list = [
              data_sample.proposals
              for data_sample in batch_data_samples
          ]
  
      # roi_head
      roi_outs = self.roi_head(x, rpn_results_list)
      results = results + (roi_outs)
  
      # semantic_head
      sem_outs = self.semantic_head.forward(x)
      results = results + (sem_outs["seg_preds"],)
  
      return results
  
file_path: mmdetection/mmdet/models/detectors/panoptic_two_stage_segmentor.py
imports: import copy
  from typing import List
  import torch
  from mmengine.structures import PixelData
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig
  from .two_stage import TwoStageDetector
label_desc: Use image node_id 6 for calling the TwoStagePanopticSegmentor obj's underlying member method code with example usage: obj._forward(batch_inputs, batch_data_samples) and returns: results