class_docstr: Visualizer that draws data about detection/segmentation on images.
  
  It contains methods like `draw_{text,box,circle,line,binary_mask,polygon}`
  that draw primitive objects to images, as well as high-level wrappers like
  `draw_{instance_predictions,sem_seg,panoptic_seg_predictions,dataset_dict}`
  that draw composite data in some pre-defined style.
  
  Note that the exact visualization style for the high-level wrappers are subject to change.
  Style such as color, opacity, label contents, visibility of labels, or even the visibility
  of objects themselves (e.g. when the object is too small) may change according
  to different heuristics, as long as the results still look visually reasonable.
  
  To obtain a consistent style, you can implement custom drawing functions with the
  abovementioned primitive methods instead. If you need more customized visualization
  styles, you can process the data yourself following their format documented in
  tutorials (:doc:`/tutorials/models`, :doc:`/tutorials/datasets`). This class does not
  intend to satisfy everyone's preference on drawing styles.
  
  This visualizer focuses on high rendering quality rather than performance. It is not
  designed to be used for real-time applications.
docstr: Args:
      img_rgb: a numpy array of shape (H, W, C), where H and W correspond to
          the height and width of the image respectively. C is the number of
          color channels. The image is required to be in RGB format since that
          is a requirement of the Matplotlib library. The image is also expected
          to be in the range [0, 255].
      metadata (Metadata): image metadata.
      instance_mode (ColorMode): defines one of the pre-defined style for drawing
          instances on an image.
docstr_tok: ["Args",":","img_rgb",":","a","numpy","array","of","shape","(","H",",","W",",","C",")",",","where","H","and","W","correspond","to","the","height","and","width","of","the","image","respectively",".","C","is","the","number","of","color","channels",".","The","image","is","required","to","be","in","RGB","format","since","that","is","a","requirement","of","the","Matplotlib","library",".","The","image","is","also","expected","to","be","in","the","range","[","0",",","255","]",".","metadata","(","Metadata",")",":","image","metadata",".","instance_mode","(","ColorMode",")",":","defines","one","of","the","pre-defined","style","for","drawing","instances","on","an","image","."]
code: def __init__(
      self,
      img_rgb,
      metadata=None,
      scale=1.0,
      instance_mode=ColorMode.IMAGE,
  ):
      """
      Args:
          img_rgb: a numpy array of shape (H, W, C), where H and W correspond to
              the height and width of the image respectively. C is the number of
              color channels. The image is required to be in RGB format since that
              is a requirement of the Matplotlib library. The image is also expected
              to be in the range [0, 255].
          metadata (Metadata): image metadata.
          instance_mode (ColorMode): defines one of the pre-defined style for drawing
              instances on an image.
      """
      self.img = np.asarray(img_rgb).clip(0, 255).astype(np.uint8)
      if metadata is None:
          metadata = MetadataCatalog.get("__nonexist__")
      self.metadata = metadata
      self.output = VisImage(self.img, scale=scale)
      self.cpu_device = torch.device("cpu")
  
      # too small texts are useless, therefore clamp to 9
      self._default_font_size = max(
          np.sqrt(self.output.height * self.output.width) // 90,
          10 // scale,
      )
      self._instance_mode = instance_mode
  
imports: import colorsys
  import logging
  import math
  from enum import Enum, unique
  import numpy
  import matplotlib
  import matplotlib.colors
  import matplotlib.figure
  import torch
  from matplotlib.backends.backend_agg import FigureCanvasAgg
  from PIL import Image
  from ..data.registry.catalog import MetadataCatalog
  from ..data.structures import BitMasks, Boxes, BoxMode, Keypoints, PolygonMasks
label_desc: Use image node_id 1 to create a new Visualizer object  with example: obj = Visualizer(img_rgb, metadata, scale, instance_mode)