code: def plot_boxes_2d(
      image,
      sample,
      predictions,
      projection=True,
      groundtruth=True,
      figsize=5,
      class_id_to_name=CLASSES,
  ):
      """Plot."""
      batch_id = 0
  
      figure = plt.figure(figsize=(figsize, figsize))
      plt.clf()
      plt.imshow(image)
  
      if projection:
          points = predictions["projected_pointclouds"].numpy()
          colors = ["r.", "g.", "b.", "c.", "m.", "y."]
          # print('HERE:', points.shape)
          for i in range(points.shape[0]):
              # print(i, points.shape)
              plt.plot(
                  points[i, :, 0],
                  points[i, :, 1],
                  colors[int(predictions["detection_classes"][i])],
              )
  
      # Plot ground truth boxes
      if groundtruth:
          sample["detection_boxes"] = sample["groundtruth_boxes"][
              batch_id
          ].numpy()
          for i in range(sample["detection_boxes"].shape[0]):
              y_min, x_min, y_max, x_max = sample["detection_boxes"][i]
              y_min *= sample["original_image_spatial_shape"][batch_id][
                  1
              ].numpy()
              y_max *= sample["original_image_spatial_shape"][batch_id][
                  1
              ].numpy()
              x_min *= sample["original_image_spatial_shape"][batch_id][
                  0
              ].numpy()
              x_max *= sample["original_image_spatial_shape"][batch_id][
                  0
              ].numpy()
              plt.plot(
                  [x_min, x_max, x_max, x_min, x_min],
                  [y_min, y_min, y_max, y_max, y_min],
                  linestyle="dashed",
              )
  
      # Plot predicted boxes
      colors = ["r", "g", "b", "c", "m", "y"]
      for i in range(predictions["detection_boxes"].shape[0]):
          x_min, y_min, x_max, y_max = predictions["detection_boxes"][i]
          plt.plot(
              [x_min, x_max, x_max, x_min, x_min],
              [y_min, y_min, y_max, y_max, y_min],
              linestyle="solid",
              color=colors[int(predictions["detection_classes"][i])],
          )
          plt.text(
              x_min,
              y_min,
              str(i)
              + "_"
              + class_id_to_name[
                  int(predictions["detection_classes"][i])
              ]
              + str(
                  int(predictions["detection_scores"][i] * 1000)
                  / 1000.0
              ),
          )
      plt.axis("off")
      plt.tight_layout()
      return figure
  
imports: import os
  import pickle
  import re
  import matplotlib.pyplot
  import numpy
  import tensorflow
  from tensorflow_graphics.projects.points_to_3Dobjects.utils import tf_utils
  from google3.pyglib import gfile
label_desc: Use image node_id 8 for calling a global function with example usage: plot_boxes_2d(image, sample, predictions, projection, groundtruth, figsize, class_id_to_name) and returns: figure