code: def compute_iou(
      sess,
      feed_dict,
      latent_holder,
      point_holder,
      latent,
      occ,
      point,
      label,
      hparams,
  ):
      """Compute IoU."""
      iou = 0.0
      eps = 1e-9
      latent_val = sess.run(latent, feed_dict)
      n_points = point.shape[2]
      preds = []
      for start in range(0, n_points, 100000):
          feed_dict[point_holder] = point[:, :, start : start + 100000]
          feed_dict[latent_holder] = latent_val
          pred = sess.run(occ, feed_dict)
          preds.append(pred)
      pred = np.concatenate(preds, axis=2)
      pred = (pred >= hparams.level_set).astype(np.float32)
      label = (label[:, :1] >= 0.5).astype(np.float32).squeeze(axis=1)
      iou += np.sum(pred * label) / np.maximum(
          np.sum(np.maximum(pred, label)), eps
      )
      return iou
  
imports: from os import path
  import numpy
  from skimage import measure
  import tensorflow.compat.v1
  from tensorflow_graphics.projects.cvxnet.lib.libmise import mise
  from tensorflow_graphics.projects.nasa.lib import datasets
  from tensorflow_graphics.projects.nasa.lib import models
  import tensorflow_probability
  from tqdm import trange
  import trimesh
label_desc: Use image node_id 8 for calling a global function with example usage: compute_iou(sess, feed_dict, latent_holder, point_holder, latent, occ, point, label, hparams) and returns: iou