code: def plot_samples(
      images, targets: List[Dict[str, np.ndarray]], classes: List[str]
  ) -> None:
      cmap = get_cmap("gist_rainbow", len(classes))
      # Unnormalize image
      nb_samples = min(len(images), 4)
      _, axes = plt.subplots(1, nb_samples, figsize=(20, 5))
      for idx in range(nb_samples):
          img = (
              (255 * images[idx].numpy())
              .round()
              .clip(0, 255)
              .astype(np.uint8)
          )
          if img.shape[0] == 3 and img.shape[2] != 3:
              img = img.transpose(1, 2, 0)
          target = img.copy()
          for box, class_idx in zip(
              targets[idx]["boxes"].numpy(), targets[idx]["labels"]
          ):
              r, g, b, _ = cmap(class_idx.numpy())
              color = (
                  int(round(255 * r)),
                  int(round(255 * g)),
                  int(round(255 * b)),
              )
              cv2.rectangle(
                  target,
                  (int(box[0]), int(box[1])),
                  (int(box[2]), int(box[3])),
                  color,
                  2,
              )
              text_size, _ = cv2.getTextSize(
                  classes[class_idx], cv2.FONT_HERSHEY_SIMPLEX, 1, 2
              )
              text_w, text_h = text_size
              cv2.rectangle(
                  target,
                  (int(box[0]), int(box[1])),
                  (int(box[0]) + text_w, int(box[1]) - text_h),
                  color,
                  -1,
              )
              cv2.putText(
                  target,
                  classes[class_idx],
                  (int(box[0]), int(box[1])),
                  cv2.FONT_HERSHEY_SIMPLEX,
                  1,
                  (255, 255, 255),
                  2,
              )
  
          axes[idx].imshow(target)
      # Disable axis
      for ax in axes.ravel():
          ax.axis("off")
      plt.show()
  
file_path: doctr/references/obj_detection/utils.py
imports: from typing import Dict, List
  import cv2
  import matplotlib.pyplot
  import numpy
  from matplotlib.cm import get_cmap
label_desc: Use image node_id 1 for calling a global function with example usage: plot_samples(images, targets, classes) without return types