code: def vis_objects(
      image, objects, colormap=None, labels=True, scale=1, fill=30
  ):
      """Visualize objects as returned by `Detector`.
  
      Arguments:
          image (numpy.ndarray): Image to draw the bounding boxes on.
          objects (list of dicts or dict): List of objects as returned by a
              `Detector` instance.
          colormap (function): Colormap function to use for the objects.
          labels (boolean): Whether to draw labels.
          scale (float): Scale factor for the box sizes, which will enlarge or
              shrink the width of the boxes and the fonts.
          fill (int): Integer between 0..255 to use as fill for the bounding
              boxes.
  
      Returns:
          A PIL image with the detected objects' bounding boxes and labels drawn.
          Can be casted to a `numpy.ndarray` by using `numpy.array` on the
          returned object.
      """
      if not isinstance(objects, list):
          objects = [objects]
  
      if colormap is None:
          colormap = build_colormap()
  
      image = Image.fromarray(image.astype(np.uint8))
  
      draw = ImageDraw.Draw(image, "RGBA")
      for obj in objects:
          # TODO: Can we do image resolution-agnostic?
          color = colormap(obj["label"])
  
          # Cast `width` to int so it also works in Python 2
          draw_rectangle(
              draw,
              obj["bbox"],
              color,
              width=int(round(3 * scale)),
              fill=fill,
          )
          if labels:
              draw_label(
                  draw,
                  obj["bbox"][:2],
                  obj["label"],
                  obj["prob"],
                  color,
                  scale=scale,
              )
  
      return image
  
file_path: luminoth/luminoth/vis.py
imports: import numpy
  import sys
  from PIL import Image, ImageDraw, ImageFont
label_desc: Use image node_id 6 for calling a global function with example usage: vis_objects(image, objects, colormap, labels, scale, fill) and returns: image