class_docstr: Generalized R-CNN. Any models that contains the following three components:
  1. Per-image feature extraction (aka backbone)
  2. Region proposal generation
  3. Per-region feature extraction and prediction
class_docstr_tok: ["Generalized","R-CNN",".","Any","models","that","contains","the","following","three","components",":","1",".","Per-image","feature","extraction","(","aka","backbone",")","2",".","Region","proposal","generation","3",".","Per-region","feature","extraction","and","prediction"]
docstr: Args:
      backbone: a backbone module, must follow detectron2's backbone interface
      proposal_generator: a module that generates proposals using backbone features
      roi_heads: a ROI head that performs per-region computation
      pixel_mean, pixel_std: list or tuple with #channels element, representing
          the per-channel mean and std to be used to normalize the input image
      input_format: describe the meaning of channels of input. Needed by visualization
      vis_period: the period to run visualization. Set to 0 to disable.
docstr_tok: ["Args",":","backbone",":","a","backbone","module",",","must","follow","detectron2","'s","backbone","interface","proposal_generator",":","a","module","that","generates","proposals","using","backbone","features","roi_heads",":","a","ROI","head","that","performs","per-region","computation","pixel_mean",",","pixel_std",":","list","or","tuple","with","#","channels","element",",","representing","the","per-channel","mean","and","std","to","be","used","to","normalize","the","input","image","input_format",":","describe","the","meaning","of","channels","of","input",".","Needed","by","visualization","vis_period",":","the","period","to","run","visualization",".","Set","to","0","to","disable","."]
code: def __init__(
      self,
      *,
      backbone: Backbone,
      proposal_generator: nn.Module,
      roi_heads: nn.Module,
      pixel_mean: Tuple[float],
      pixel_std: Tuple[float],
      input_format: Optional[str] = None,
      vis_period: int = 0,
  ):
      """
      Args:
          backbone: a backbone module, must follow detectron2's backbone interface
          proposal_generator: a module that generates proposals using backbone features
          roi_heads: a ROI head that performs per-region computation
          pixel_mean, pixel_std: list or tuple with #channels element, representing
              the per-channel mean and std to be used to normalize the input image
          input_format: describe the meaning of channels of input. Needed by visualization
          vis_period: the period to run visualization. Set to 0 to disable.
      """
      super().__init__()
      self.backbone = backbone
      self.proposal_generator = proposal_generator
      self.roi_heads = roi_heads
  
      self.input_format = input_format
      self.vis_period = vis_period
      if vis_period > 0:
          assert (
              input_format is not None
          ), "input_format is required for visualization!"
  
      self.register_buffer(
          "pixel_mean", torch.tensor(pixel_mean).view(-1, 1, 1), False
      )
      self.register_buffer(
          "pixel_std", torch.tensor(pixel_std).view(-1, 1, 1), False
      )
      assert (
          self.pixel_mean.shape == self.pixel_std.shape
      ), f"{self.pixel_mean} and {self.pixel_std} have different shapes!"
  
imports: import logging
  import numpy
  from typing import Dict, List, Optional, Tuple
  import torch
  from torch import nn
  from detectron2.config import configurable
  from detectron2.data.detection_utils import convert_image_to_rgb
  from detectron2.layers import move_device_like
  from detectron2.structures import ImageList, Instances
  from detectron2.utils.events import get_event_storage
  from detectron2.utils.logger import log_first_n
  from ..backbone import Backbone, build_backbone
  from ..postprocessing import detector_postprocess
  from ..proposal_generator import build_proposal_generator
  from ..roi_heads import build_roi_heads
  from .build import META_ARCH_REGISTRY
label_desc: Use image node_id 1 to create a new GeneralizedRCNN object from inherited base classes: nn with example: obj = GeneralizedRCNN()