class_docstr: Implementation of Region Proposal Network.
  
  Args:
      backbone (:obj:`ConfigDict` or dict): The backbone config.
      neck (:obj:`ConfigDict` or dict): The neck config.
      bbox_head (:obj:`ConfigDict` or dict): The bbox head config.
      train_cfg (:obj:`ConfigDict` or dict, optional): The training config.
      test_cfg (:obj:`ConfigDict` or dict, optional): The testing config.
      data_preprocessor (:obj:`ConfigDict` or dict, optional): Config of
          :class:`DetDataPreprocessor` to process the input data.
          Defaults to None.
      init_cfg (:obj:`ConfigDict` or list[:obj:`ConfigDict`] or dict or
          list[dict], optional): Initialization config dict.
          Defaults to None.
class_docstr_tok: ["Implementation","of","Region","Proposal","Network",".","Args",":","backbone","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","backbone","config",".","neck","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","neck","config",".","bbox_head","(",":","obj",":","`","ConfigDict","`","or","dict",")",":","The","bbox","head","config",".","train_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","The","training","config",".","test_cfg","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","The","testing","config",".","data_preprocessor","(",":","obj",":","`","ConfigDict","`","or","dict",",","optional",")",":","Config","of",":","class",":","`","DetDataPreprocessor","`","to","process","the","input","data",".","Defaults","to","None",".","init_cfg","(",":","obj",":","`","ConfigDict","`","or","list","[",":","obj",":","`","ConfigDict","`","]","or","dict","or","list","[","dict","]",",","optional",")",":","Initialization","config","dict",".","Defaults","to","None","."]
code: def __init__(
      self,
      backbone: ConfigType,
      neck: ConfigType,
      rpn_head: ConfigType,
      train_cfg: ConfigType,
      test_cfg: ConfigType,
      data_preprocessor: OptConfigType = None,
      init_cfg: OptMultiConfig = None,
      **kwargs,
  ) -> None:
      super(SingleStageDetector, self).__init__(
          data_preprocessor=data_preprocessor, init_cfg=init_cfg
      )
      self.backbone = MODELS.build(backbone)
      self.neck = MODELS.build(neck) if neck is not None else None
      rpn_train_cfg = (
          train_cfg["rpn"] if train_cfg is not None else None
      )
      rpn_head_num_classes = rpn_head.get("num_classes", 1)
      if rpn_head_num_classes != 1:
          warnings.warn(
              "The `num_classes` should be 1 in RPN, but get "
              f"{rpn_head_num_classes}, please set "
              "rpn_head.num_classes = 1 in your config file."
          )
          rpn_head.update(num_classes=1)
      rpn_head.update(train_cfg=rpn_train_cfg)
      rpn_head.update(test_cfg=test_cfg["rpn"])
      self.bbox_head = MODELS.build(rpn_head)
      self.train_cfg = train_cfg
      self.test_cfg = test_cfg
  
file_path: mmdetection/mmdet/models/detectors/rpn.py
imports: import copy
  import warnings
  import torch
  from torch import Tensor
  from mmdet.registry import MODELS
  from mmdet.structures import SampleList
  from mmdet.utils import ConfigType, OptConfigType, OptMultiConfig
  from .single_stage import SingleStageDetector
label_desc: Use image node_id 1 to create a new RPN object from inherited base classes: SingleStageDetector with example: obj = RPN(backbone, neck, rpn_head, train_cfg, test_cfg, data_preprocessor, init_cfg)