code: def draw_boxes_on_image(
      image_path: str,
      boxes: np.ndarray,
      scores: np.ndarray,
      labels: np.ndarray,
      label_names: List[str],
      score_thresh: float = 0.5,
      save_path: str = "result",
  ):
      """Draw boxes on images."""
      # On windows, importing paddlenlp and matplotlib at the same time will cause python
      # to fail to catch C++ exceptions. Delay matplotlib to avoid this problem.
      import matplotlib as plt
  
      image = np.array(PIL.Image.open(image_path))
      plt.figure()
      _, ax = plt.subplots(1)
      ax.imshow(image)
  
      image_name = image_path.split("/")[-1]
      print("Image {} detect: ".format(image_name))
      colors = {}
      for box, score, label in zip(boxes, scores, labels):
          if score < score_thresh:
              continue
          if box[2] <= box[0] or box[3] <= box[1]:
              continue
          label = int(label)
          if label not in colors:
              colors[label] = plt.get_cmap("hsv")(
                  label / len(label_names)
              )
          x1, y1, x2, y2 = box[0], box[1], box[2], box[3]
          rect = plt.Rectangle(
              (x1, y1),
              x2 - x1,
              y2 - y1,
              fill=False,
              linewidth=2.0,
              edgecolor=colors[label],
          )
          ax.add_patch(rect)
          ax.text(
              x1,
              y1,
              "{} {:.4f}".format(label_names[label], score),
              verticalalignment="bottom",
              horizontalalignment="left",
              bbox={"facecolor": colors[label], "alpha": 0.5, "pad": 0},
              fontsize=8,
              color="white",
          )
          print(
              "\t {:15s} at {:25} score: {:.5f}".format(
                  label_names[int(label)],
                  str(list(map(int, list(box)))),
                  score,
              )
          )
      image_name = image_name.replace("jpg", "png")
      plt.axis("off")
      plt.gca().xaxis.set_major_locator(plt.NullLocator())
      plt.gca().yaxis.set_major_locator(plt.NullLocator())
      plt.savefig(
          "{}/{}".format(save_path, image_name),
          bbox_inches="tight",
          pad_inches=0.0,
      )
      plt.cla()
      plt.close("all")
  
imports: import os
  from typing import Callable, Union, List, Tuple
  import cv2
  import paddle
  import PIL
  import numpy
  import paddle.nn.functional
  from scipy.sparse import csr_matrix
label_desc: Use image node_id 5 for calling a global function with example usage: draw_boxes_on_image(image_path, boxes, scores, labels, label_names, score_thresh, save_path) without return types