class_docstr: Visualizer that draws data about detection on images.
  
  It contains methods like `draw_{text,box}`
  that draw primitive objects to images, as well as high-level wrappers like
  `draw_{instance_predictions}` 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.  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.
class_docstr_tok: ["Visualizer","that","draws","data","about","detection","on","images",".","It","contains","methods","like","`","draw_","{","text",",","box","}","`","that","draw","primitive","objects","to","images",",","as","well","as","high-level","wrappers","like","`","draw_","{","instance_predictions","}","`","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",".","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: Process the classes, box coordinates and confidence scores of the predictions in the image
  
  Parameters
  ----------
  predictions (pd.DataFrame): the output of object detection with 2 attributes:
      "image": containing paths to the source image
      "bboxes": containing detection results for the images with the following format
          {"class": <predicted_class_name>, "bbox": [x1, y1, x2, y2], "score": <confidence_score>}
  conf_threshold (float): detection confidence threshold to display instances
  
  Returns
  -------
  boxes: XYXY format of bounding boxes shape = (N, 4)
  scores: detection confidence scores, shape = (N, )
  classes: detection classes, shape = (N, )
code: def process_predictions(
      predictions: pd.DataFrame, conf_threshold: float = 0.4
  ):
      """
      Process the classes, box coordinates and confidence scores of the predictions in the image
  
      Parameters
      ----------
      predictions (pd.DataFrame): the output of object detection with 2 attributes:
          "image": containing paths to the source image
          "bboxes": containing detection results for the images with the following format
              {"class": <predicted_class_name>, "bbox": [x1, y1, x2, y2], "score": <confidence_score>}
      conf_threshold (float): detection confidence threshold to display instances
  
      Returns
      -------
      boxes: XYXY format of bounding boxes shape = (N, 4)
      scores: detection confidence scores, shape = (N, )
      classes: detection classes, shape = (N, )
      """
      boxes, scores, classes = [], [], []
      instances = predictions["bboxes"]
      for instance in instances:
          s = instance["score"]
          if s >= conf_threshold:
              box = instance["bbox"]
              c = instance["class"]
              boxes.append(box)
              scores.append(s)
              classes.append(c)
      boxes = np.array(boxes)
      scores = np.array(scores)
      classes = np.array(classes)
      assert (
          len(boxes) == len(scores) == len(classes)
      ), "Expected boxes, scores and classes to have the same length, but got len(boxes): {}, len(scores) = {}, len(classes) = {}".format(
          len(boxes), len(scores), len(classes)
      )
      if len(boxes) == 0:
          return None, None, None
      return boxes, scores, classes
  
imports: import collections
  import colorsys
  import logging
  import re
  from enum import Enum, unique
  from typing import List
  import matplotlib
  import matplotlib.colors
  import matplotlib.figure
  import matplotlib.pyplot
  import numpy
  import pandas
  from matplotlib.backends.backend_agg import FigureCanvasAgg
  from PIL import Image
  from .colormap import random_color
  from .misc import merge_spans
label_desc: Use image node_id 2 for calling the ObjectDetectionVisualizer obj's underlying member method code with example usage: obj.process_predictions(predictions, conf_threshold) and returns: boxes,  scores,  classes, None,  None,  None