code: def save_for_blender(
      detections,
      sample,
      log_dir,
      dict_clusters,
      shape_pointclouds,
      class_id_to_name=CLASSES,
  ):
      """Save for blender."""
      # VisualDebugging uses the OpenCV coordinate representation
      # while the dataset uses OpenGL (left-hand) so make sure to convert y and z.
  
      batch_id = 0
      prefix = "/cns/lu-d/home/giotto3d/datasets/shapenet/raw/"
      sufix = "models/model_normalized.obj"
  
      blender_dict = {}
      blender_dict["image"] = tf.io.decode_image(
          sample["image_data"][batch_id]
      ).numpy()
      blender_dict["world_to_cam"] = sample["rt"].numpy()
      num_predicted_shapes = int(detections["sizes_3d"].shape[0])
      blender_dict["num_predicted_shapes"] = num_predicted_shapes
      blender_dict["predicted_rotations_3d"] = tf.reshape(
          detections["rotations_3d"], [-1, 3, 3]
      ).numpy()
      blender_dict["predicted_rotations_y"] = [
          tf_utils.euler_from_rotation_matrix(
              tf.reshape(detections["rotations_3d"][i], [3, 3]), 1
          ).numpy()
          for i in range(num_predicted_shapes)
      ]
      blender_dict["predicted_translations_3d"] = detections[
          "translations_3d"
      ].numpy()
      blender_dict["predicted_sizes_3d"] = detections[
          "sizes_3d"
      ].numpy()
      predicted_shapes_path = []
      for i in range(num_predicted_shapes):
          shape = detections["shapes"][i].numpy()
          _, class_str, model_str = dict_clusters[shape]
          filename = os.path.join(prefix, class_str, model_str, sufix)
          predicted_shapes_path.append(filename)
      blender_dict["predicted_shapes_path"] = predicted_shapes_path
      blender_dict["predicted_class"] = [
          class_id_to_name[
              int(detections["detection_classes"][i].numpy())
          ]
          for i in range(num_predicted_shapes)
      ]
  
      blender_dict["predicted_pointcloud"] = [
          shape_pointclouds[int(detections["shapes"][i].numpy())]
          for i in range(num_predicted_shapes)
      ]
  
      num_groundtruth_shapes = int(
          sample["sizes_3d"][batch_id].shape[0]
      )
      blender_dict["num_groundtruth_shapes"] = num_groundtruth_shapes
      blender_dict["groundtruth_rotations_3d"] = tf.reshape(
          sample["rotations_3d"][batch_id], [-1, 3, 3]
      ).numpy()
      blender_dict["groundtruth_rotations_y"] = [
          tf_utils.euler_from_rotation_matrix(
              tf.reshape(sample["rotations_3d"][batch_id][i], [3, 3]), 1
          ).numpy()
          for i in range(sample["num_boxes"][batch_id].numpy())
      ]
      blender_dict["groundtruth_translations_3d"] = sample[
          "translations_3d"
      ][batch_id].numpy()
      blender_dict["groundtruth_sizes_3d"] = sample["sizes_3d"][
          batch_id
      ].numpy()
      groundtruth_shapes_path = []
      for i in range(num_groundtruth_shapes):
          class_str = str(sample["classes"][batch_id, i].numpy()).zfill(
              8
          )
          model_str = str(sample["mesh_names"][batch_id, i].numpy())[
              2:-1
          ]
          filename = os.path.join(prefix, class_str, model_str, sufix)
          groundtruth_shapes_path.append(filename)
      blender_dict["groundtruth_shapes_path"] = groundtruth_shapes_path
      blender_dict["groundtruth_classes"] = sample[
          "groundtruth_valid_classes"
      ].numpy()
  
      path = log_dir + ".pkl"
      with gfile.Open(path, "wb") as file:
          pickle.dump(blender_dict, file)
  
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 16 for calling a global function with example usage: save_for_blender(detections, sample, log_dir, dict_clusters, shape_pointclouds, class_id_to_name) without return types