class_docstr: Base class for two-stage detectors.
  
  Two-stage detectors typically consisting of a region proposal network and a
  task-specific regression head.
class_docstr_tok: ["Base","class","for","two-stage","detectors",".","Two-stage","detectors","typically","consisting","of","a","region","proposal","network","and","a","task-specific","regression","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).
      batch_data_samples (list[:obj:`DetDataSample`]): Each item contains
          the meta information of each image and corresponding
          annotations.
  
  Returns:
      tuple: A tuple of features from ``rpn_head`` and ``roi_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",")",".","batch_data_samples","(","list","[",":","obj",":","`","DetDataSample","`","]",")",":","Each","item","contains","the","meta","information","of","each","image","and","corresponding","annotations",".","Returns",":","tuple",":","A","tuple","of","features","from","``","rpn_head","``","and","``","roi_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).
          batch_data_samples (list[:obj:`DetDataSample`]): Each item contains
              the meta information of each image and corresponding
              annotations.
  
      Returns:
          tuple: A tuple of features from ``rpn_head`` and ``roi_head``
          forward.
      """
      results = ()
      x = self.extract_feat(batch_inputs)
  
      if self.with_rpn:
          rpn_results_list = self.rpn_head.predict(
              x, batch_data_samples, rescale=False
          )
      else:
          assert (
              batch_data_samples[0].get("proposals", None) is not None
          )
          rpn_results_list = [
              data_sample.proposals
              for data_sample in batch_data_samples
          ]
      roi_outs = self.roi_head.forward(
          x, rpn_results_list, batch_data_samples
      )
      results = results + (roi_outs,)
      return results
  
file_path: mmdetection/mmdet/models/detectors/two_stage.py
imports: import copy
  import warnings
  from typing import List, Tuple, Union
  import torch
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig
  from .base import BaseDetector
label_desc: Use image node_id 6 for calling the TwoStageDetector obj's underlying member method code with example usage: obj._forward(batch_inputs, batch_data_samples) and returns: results