class_docstr: Wrapper of a mmdetection detector model, for detection and instance segmentation.
  Input/output formats of this class follow detectron2's convention, so a
  mmdetection model can be trained and evaluated in detectron2.
class_docstr_tok: ["Wrapper","of","a","mmdetection","detector","model",",","for","detection","and","instance","segmentation",".","Input\/output","formats","of","this","class","follow","detectron2","'s","convention",",","so","a","mmdetection","model","can","be","trained","and","evaluated","in","detectron2","."]
docstr: Args:
      detector: a mmdet detector, or a mmdet config dict that defines a detector.
      size_divisibility: pad input images to multiple of this number
      pixel_mean: per-channel mean to normalize input image
      pixel_std: per-channel stddev to normalize input image
docstr_tok: ["Args",":","detector",":","a","mmdet","detector",",","or","a","mmdet","config","dict","that","defines","a","detector",".","size_divisibility",":","pad","input","images","to","multiple","of","this","number","pixel_mean",":","per-channel","mean","to","normalize","input","image","pixel_std",":","per-channel","stddev","to","normalize","input","image"]
code: def __init__(
      self,
      detector: Union[nn.Module, Mapping],
      *,
      # Default is 32 regardless of model:
      # https://github.com/open-mmlab/mmdetection/tree/master/configs/_base_/datasets
      size_divisibility=32,
      pixel_mean: Tuple[float],
      pixel_std: Tuple[float],
  ):
      """
      Args:
          detector: a mmdet detector, or a mmdet config dict that defines a detector.
          size_divisibility: pad input images to multiple of this number
          pixel_mean: per-channel mean to normalize input image
          pixel_std: per-channel stddev to normalize input image
      """
      super().__init__()
      if isinstance(detector, Mapping):
          from mmdet.models import build_detector
  
          detector = build_detector(_to_container(detector))
      self.detector = detector
      self.detector.init_weights()
      self.size_divisibility = size_divisibility
  
      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 itertools
  import logging
  import numpy
  from collections import OrderedDict
  from collections.abc import Mapping
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from omegaconf import DictConfig, OmegaConf
  from torch import Tensor, nn
  from detectron2.layers import ShapeSpec
  from detectron2.structures import BitMasks, Boxes, ImageList, Instances
  from detectron2.utils.events import get_event_storage
  from .backbone import Backbone
label_desc: Use image node_id 1 to create a new MMDetDetector object from inherited base classes: nn with example: obj = MMDetDetector(detector)