import tensorflow as tf

import numpy as np
import tensorflow as tf
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


class ShapeAccuracyMetric:
  """Computes the accuracy of shpe prediction."""

  def __init__(self, k=1):
    self.metric = tf.keras.metrics.SparseTopKCategoricalAccuracy(k)

  def update(self, sparse_labels, predicted_probabilities, sample_weights=None):
    self.metric.update_state(sparse_labels, predicted_probabilities,
                             sample_weights)

  def evaluate(self):
    return self.metric.result().numpy()

  def reset(self):
    self.metric.reset_states()


def get_2d_bounding_box_iou(box1, box2):
