class_docstr: Collision.
docstr: Update.
docstr_tok: ["Update","."]
code: def update(
      self,
      labeled_sdfs,
      labeled_classes,
      labeled_poses,
      predicted_sdfs,
      predicted_classes,
      predicted_poses,
  ):
      """Update."""
      if labeled_sdfs or labeled_classes:
          print(labeled_sdfs)
      mean_x = tf.reduce_mean(labeled_poses[1][:, 0])
      mean_z = tf.reduce_mean(labeled_poses[1][:, 2])
      samples_world = grid.generate(
          (mean_x - 0.5, 0.0, mean_z - 0.5),
          (mean_x + 0.5, 1.0, mean_z + 0.5),
          [self.resolution, self.resolution, self.resolution],
      )
      samples_world = tf.reshape(samples_world, [-1, 3])
  
      status = False
      if status:
          _, axs = plt.subplots(3, 3)
          fig_obj_count = 0
  
      # Do the same for the ground truth and predictions
      num_collisions = 0
      prev_intersection = 0
      sdf_values = tf.zeros_like(samples_world)[:, 0:1]
      for classes, sdfs, poses in [
          (predicted_classes, predicted_sdfs, predicted_poses)
      ]:
          for i in range(classes.shape[0]):
              sdf = tf.expand_dims(sdfs[i], -1)
              sdf = sdf * -1.0  # inside positive, outside zero
              samples_object = (
                  centernet_utils.transform_pointcloud(
                      tf.reshape(samples_world, [1, 1, -1, 3]),
                      tf.reshape(poses[2][i], [1, 1, 3]),
                      tf.reshape(poses[0][i], [1, 1, 3, 3]),
                      tf.reshape(poses[1][i], [1, 1, 3]),
                      inverse=True,
                  )
                  * 2.0
              )
              samples_object = (
                  samples_object * (29.0 / 32.0) / 2.0 + 0.5
              ) * 32.0 - 0.5
              samples = tf.squeeze(samples_object)
              interpolated = trilinear.interpolate(sdf, samples)
              occupancy_value = tf.math.sign(
                  tf.nn.relu(interpolated + self.tol)
              )
              sdf_values += occupancy_value
              intersection = tf.reduce_sum(
                  tf.math.sign(tf.nn.relu(sdf_values - 1))
              )
              if intersection > prev_intersection:
                  prev_intersection = intersection
                  num_collisions += 1
              status2 = False
              if status2:
                  a = 1
                  values = interpolated
                  inter = tf.reshape(
                      values,
                      [
                          self.resolution,
                          self.resolution,
                          self.resolution,
                      ],
                  )
                  inter = tf.transpose(tf.reduce_max(inter, axis=a))
                  im = axs[fig_obj_count, 0].matshow(inter.numpy())
                  plt.colorbar(im, ax=axs[fig_obj_count, 0])
  
                  values = tf.math.sign(
                      tf.nn.relu(interpolated + self.tol)
                  )
                  inter = tf.reshape(
                      values,
                      [
                          self.resolution,
                          self.resolution,
                          self.resolution,
                      ],
                  )
                  inter = tf.transpose(tf.reduce_max(inter, axis=a))
                  im = axs[fig_obj_count, 1].matshow(inter.numpy())
                  plt.colorbar(im, ax=axs[fig_obj_count, 1])
  
                  values = sdf_values
                  inter = tf.reshape(
                      values,
                      [
                          self.resolution,
                          self.resolution,
                          self.resolution,
                      ],
                  )
                  inter = tf.transpose(tf.reduce_max(inter, axis=a))
                  im = axs[fig_obj_count, 2].matshow(inter.numpy())
                  plt.colorbar(im, ax=axs[fig_obj_count, 2])
  
                  fig_obj_count += 1
  
      intersection = tf.reduce_sum(
          tf.math.sign(tf.nn.relu(sdf_values - 1))
      )
      union = tf.reduce_sum(tf.math.sign(sdf_values))
      iou = intersection / union
      self.collisions.append(num_collisions)
      self.intersections.append(intersection)
      self.ious.append(iou)
      return num_collisions, intersection, iou
  
imports: import os
  import pickle
  from absl import logging
  import matplotlib.pyplot
  import numpy
  import tensorflow
  from tensorflow_graphics.geometry.representation import grid
  from tensorflow_graphics.math.interpolation import trilinear
  from tensorflow_graphics.projects.points_to_3Dobjects.models import centernet_utils
  from tensorflow_graphics.projects.points_to_3Dobjects.utils import tf_utils
  from google3.pyglib import gfile
  from google3.third_party.google_research.google_research.tf3d.object_detection.box_utils import np_box_ops
label_desc: Use image node_id 2 for calling the CollisionMetric obj's underlying member method code with example usage: obj.update(labeled_sdfs, labeled_classes, labeled_poses, predicted_sdfs, predicted_classes, predicted_poses) and returns: num_collisions,  intersection,  iou