code: def draw_bounding_boxes(images, annotations, confidence_threshold=0):
      """
      Visualizes bounding boxes (ground truth or predictions) by
      returning annotated copies of the images.
  
      Parameters
      ----------
      images: SArray or Image
          An `SArray` of type `Image`. A single `Image` instance may also be
          given.
  
      annotations: SArray or list
          An `SArray` of annotations (either output from the
          `ObjectDetector.predict` function or ground truth). A single list of
          annotations may also be given, provided that it is coupled with a
          single image.
  
      confidence_threshold: float
          Confidence threshold can limit the number of boxes to draw. By
          default, this is set to 0, since the prediction may have already pruned
          with an appropriate confidence threshold.
  
      Returns
      -------
      annotated_images: SArray or Image
          Similar to the input `images`, except the images are decorated with
          boxes to visualize the object instances.
  
      See also
      --------
      unstack_annotations
      """
      _numeric_param_check_range(
          "confidence_threshold", confidence_threshold, 0.0, 1.0
      )
      from PIL import Image
  
      def draw_single_image(row):
          image = row["image"]
          anns = row["annotations"]
          row_number = row["id"]
          if anns == None:
              anns = []
          elif type(anns) == dict:
              anns = [anns]
          try:
              pil_img = Image.fromarray(image.pixel_data)
              _annotate_image(
                  pil_img,
                  anns,
                  confidence_threshold=confidence_threshold,
              )
              image = _np.array(pil_img)
              if len(image.shape) == 2:
                  # Grayscale image, reshape image shape
                  image = image.reshape(
                      image.shape[0], image.shape[1], 1
                  )
              FORMAT_RAW = 2
              annotated_image = _tc.Image(
                  _image_data=image.tobytes(),
                  _width=image.shape[1],
                  _height=image.shape[0],
                  _channels=image.shape[2],
                  _format_enum=FORMAT_RAW,
                  _image_data_size=image.size,
              )
          except Exception as e:
              if row_number == -1:
                  # indication that it was a single image and not an SFrame
                  raise _ToolkitError(e)
              raise _ToolkitError(
                  "Received exception at row "
                  + str(row_number)
                  + ": "
                  + str(e)
              )
          return annotated_image
  
      if isinstance(images, _tc.Image) and isinstance(
          annotations, list
      ):
          return draw_single_image(
              {"image": images, "annotations": annotations, "id": -1}
          )
      else:
          sf = _tc.SFrame({"image": images, "annotations": annotations})
          sf = sf.add_row_number()
          annotated_images = sf.apply(draw_single_image)
          return annotated_images
  
file_path: turicreate/src/python/turicreate/toolkits/object_detector/util/_visualization.py
imports: from __future__ import print_function
  from __future__ import division
  from __future__ import absolute_import
  import turicreate
  import numpy
  from turicreate.toolkits._internal_utils import _numeric_param_check_range
  from turicreate.toolkits._main import ToolkitError
label_desc: Use image node_id 3 for calling a global function with example usage: draw_bounding_boxes(images, annotations, confidence_threshold) and returns: annotated_image, draw_single_image, annotated_images