code: def draw_annotations(
      image, annotations, color=(0, 255, 0), label_to_name=None
  ):
      """Draws annotations in an image.
  
      # Arguments
          image         : The image to draw on.
          annotations   : A [N, 5] matrix (x1, y1, x2, y2, label) or dictionary containing bboxes (shaped [N, 4]) and labels (shaped [N]).
          color         : The color of the boxes. By default the color from keras_retinanet.utils.colors.label_color will be used.
          label_to_name : (optional) Functor for mapping a label to a name.
      """
      if isinstance(annotations, np.ndarray):
          annotations = {
              "bboxes": annotations[:, :4],
              "labels": annotations[:, 4],
          }
  
      assert "bboxes" in annotations
      assert "labels" in annotations
      assert (
          annotations["bboxes"].shape[0]
          == annotations["labels"].shape[0]
      )
  
      for i in range(annotations["bboxes"].shape[0]):
          label = annotations["labels"][i]
          c = color if color is not None else label_color(label)
          caption = "{}".format(
              label_to_name(label) if label_to_name else label
          )
          draw_caption(image, annotations["bboxes"][i], caption)
          draw_box(image, annotations["bboxes"][i], color=c)
  
file_path: ImageAI/imageai_tf_deprecated/Detection/keras_retinanet/utils/visualization.py
imports: import cv2
  import numpy
  from .colors import label_color
label_desc: Use image node_id 5 for calling a global function with example usage: draw_annotations(image, annotations, color, label_to_name) without return types