code: def plot_prediction(
      inputs, outputs, figsize=0.1, batch_id=0, plot_2d=False
  ):
      """Plot bounding box predictions along ground truth labels.
  
      Args:
        inputs: Dict of batched inputs to the network.
        outputs: Dict of batched outputs of the network.
        figsize: The size of the figure.
        batch_id: The batch entry to plot.
        plot_2d: Whether 2D bounding boxes should be shown or not.
  
      Returns:
        A matplotlib figure.
  
      """
      image = inputs["image"][batch_id].numpy()
      size2d = inputs["box_dim2d"][batch_id].numpy()
      size3d = inputs["box_dim3d"][batch_id].numpy()[[0, 2, 1]]
      center2d = inputs["center2d"][batch_id].numpy()
      center3d = inputs["center3d"][batch_id].numpy()
      predicted_center2d = outputs["center2d"][batch_id].numpy()
      predicted_size2d = outputs["size2d"][batch_id].numpy()
      predicted_rotation = outputs["rotation"][batch_id].numpy()
      predicted_center3d = outputs["center3d"][batch_id].numpy().T
      predicted_size3d = outputs["size3d"][batch_id].numpy()[[0, 2, 1]]
      # dot = outputs['dot'][batch_id].numpy()
      intrinsics = inputs["k"][batch_id].numpy()
      pose_world2camera = inputs["rt"][batch_id].numpy()
      object_translation = np.squeeze(center3d[0:3])
      object_rotation = inputs["rotation"][batch_id].numpy()
  
      pose_obj2world = np.eye(4)
      rad = np.deg2rad(object_rotation * -1)
      cos = np.cos(rad)
      sin = np.sin(rad)
      pose_obj2world[0, 0] = cos
      pose_obj2world[0, 1] = sin
      pose_obj2world[1, 1] = cos
      pose_obj2world[1, 0] = -sin
      pose_obj2world[0:3, 3] = object_translation
  
      predicted_pose_obj2world = np.eye(4)
      predicted_pose_obj2world[0:2, 0:2] = predicted_rotation
      predicted_pose_obj2world[0:3, 3] = predicted_center3d
  
      figure = plt.figure(figsize=(figsize, figsize))
      plt.clf()
      plt.imshow(image / 255.0)
      plt.plot(center2d[0], center2d[1], "g*")
  
      def draw_ground_plane(camera_intrinsic, pose_world2camera):
          """Draw ground plane as grid.
  
          Args:
            camera_intrinsic: Camera intrinsic.
            pose_world2camera: Camera extrinsic.
          """
          line = np.array([[-3, 3, 0, 1], [3, 3, 0, 1]]).T
          projected_line = camera_intrinsic @ pose_world2camera @ line
          projected_line = projected_line[0:2, :] / projected_line[2, :]
          plt.plot(
              projected_line[0, [0, 1]],
              projected_line[1, [0, 1]],
              "black",
              linewidth=1,
          )
  
      def draw_bounding_box_2d(center, size, style="b+-"):
          bbox2d = np.tile(
              np.reshape(center, [1, 2]), [4, 1]
          )  # shape: (4, 2)
          bbox2d[0, :] += np.array([-size[0], -size[1]])
          bbox2d[1, :] += np.array([size[0], -size[1]])
          bbox2d[2, :] += np.array([size[0], size[1]])
          bbox2d[3, :] += np.array([-size[0], size[1]])
          plt.plot(
              bbox2d[[0, 1, 2, 3, 0], 0],
              bbox2d[[0, 1, 2, 3, 0], 1],
              style,
          )
  
      draw_bounding_box_3d(
          size3d,
          pose_obj2world,
          intrinsics,
          pose_world2camera,
          "dashed",
      )
      draw_ground_plane(intrinsics, pose_world2camera)
      # draw_coordinate_frame(intrinsics, pose_world2camera)
      draw_bounding_box_3d(
          predicted_size3d,
          predicted_pose_obj2world,
          intrinsics,
          pose_world2camera,
      )
  
      if plot_2d:
          draw_bounding_box_2d(center2d, size2d / 2, "g-")
          draw_bounding_box_2d(
              predicted_center2d, predicted_size2d / 2, "b-"
          )
      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 14 for calling a global function with example usage: plot_prediction(inputs, outputs, figsize, batch_id, plot_2d) and returns: figure