docstr: Args:
      image (np.ndarray): an image of shape (H, W, C) (in BGR order).
          This is the format used by OpenCV.
  
  Returns:
      predictions (dict): the output of the model.
      vis_output (VisImage): the visualized image output.
docstr_tok: ["Args",":","image","(","np.ndarray",")",":","an","image","of","shape","(","H",",","W",",","C",")","(","in","BGR","order",")",".","This","is","the","format","used","by","OpenCV",".","Returns",":","predictions","(","dict",")",":","the","output","of","the","model",".","vis_output","(","VisImage",")",":","the","visualized","image","output","."]
code: def run_on_image(self, image):
      """
      Args:
          image (np.ndarray): an image of shape (H, W, C) (in BGR order).
              This is the format used by OpenCV.
  
      Returns:
          predictions (dict): the output of the model.
          vis_output (VisImage): the visualized image output.
      """
      vis_output = None
      predictions = self.predictor(image)
      # Convert image from OpenCV BGR format to Matplotlib RGB format.
      image = image[:, :, ::-1]
      visualizer = Visualizer(
          image, self.metadata, instance_mode=self.instance_mode
      )
      if "panoptic_seg" in predictions:
          panoptic_seg, segments_info = predictions["panoptic_seg"]
          vis_output = visualizer.draw_panoptic_seg_predictions(
              panoptic_seg.to(self.cpu_device), segments_info
          )
      else:
          if "sem_seg" in predictions:
              vis_output = visualizer.draw_sem_seg(
                  predictions["sem_seg"]
                  .argmax(dim=0)
                  .to(self.cpu_device)
              )
          if "instances" in predictions:
              instances = predictions["instances"].to(self.cpu_device)
              vis_output = visualizer.draw_instance_predictions(
                  predictions=instances
              )
  
      return predictions, vis_output
  
imports: import atexit
  import bisect
  import multiprocessing
  from collections import deque
  import cv2
  import torch
  from detectron2.data import MetadataCatalog
  from detectron2.engine.defaults import DefaultPredictor
  from detectron2.utils.video_visualizer import VideoVisualizer
  from detectron2.utils.visualizer import ColorMode, Visualizer
label_desc: Use image node_id 2 for calling the VisualizationDemo obj's underlying member method code with example usage: obj.run_on_image(image) and returns: predictions,  vis_output