code: def evaluate(hook_dict, ckpt, saver, best_iou, hparams):
      """Evaluate a checkpoint on the whole test set."""
      batch = hook_dict["batch"]
      merged_summary = hook_dict["merged_summary"]
      iou_holder = hook_dict["iou_holder"]
      best_holder = hook_dict["best_holder"]
      batch_holder = hook_dict["batch_holder"]
      latent_holder = hook_dict["latent_holder"]
      latent = hook_dict["latent"]
      occ = hook_dict["occ"]
      global_step = utils.parse_global_step(ckpt)
  
      assignment_map = {
          "shape/": "shape/",
      }
      tf.train.init_from_checkpoint(ckpt, assignment_map)
      init_op = tf.global_variables_initializer()
  
      with tf.Session() as sess:
          sess.run(init_op)
          accum_iou = 0.0
          example_cnt = 0
          while True:
              try:
                  batch_val = sess.run(batch)
                  feed_dict = {
                      batch_holder["transform"]: batch_val["transform"],
                      batch_holder["joint"]: batch_val["joint"],
                  }
  
                  iou = utils.compute_iou(
                      sess,
                      feed_dict,
                      latent_holder,
                      batch_holder["point"],
                      latent,
                      occ[:, -1:],
                      batch_val["points"],
                      batch_val["labels"],
                      hparams,
                  )
                  accum_iou += iou
                  example_cnt += 1
  
                  if hparams.gen_mesh_only > 0:
                      # Generate meshes for evaluation
                      unused_var = utils.save_mesh(
                          sess,
                          feed_dict,
                          latent_holder,
                          batch_holder["point"],
                          latent,
                          occ,
                          batch_val,
                          hparams,
                      )
                      logging.info(
                          "Generated mesh No.{}".format(example_cnt)
                      )
  
              except tf.errors.OutOfRangeError:
                  accum_iou /= example_cnt
  
                  if best_iou < accum_iou:
                      best_iou = accum_iou
                      saver.save(
                          sess,
                          path.join(
                              hparams.train_dir, "best", "model.ckpt"
                          ),
                          global_step,
                      )
                  summary = sess.run(
                      merged_summary,
                      utils.make_summary_feed_dict(
                          iou_holder,
                          accum_iou,
                          best_holder,
                          best_iou,
                      ),
                  )
  
                  # If only generating meshes for the sequence, we can determinate the
                  # evaluation after the first full loop over the test set.
                  if hparams.gen_mesh_only:
                      exit(0)
  
                  break
  
      return summary, global_step
  
file_path: graphics/tensorflow_graphics/projects/nasa/eval.py
imports: from os import path
  import numpy
  import tensorflow.compat.v1
  from tensorflow_graphics.projects.nasa.lib import datasets
  from tensorflow_graphics.projects.nasa.lib import models
  from tensorflow_graphics.projects.nasa.lib import utils
label_desc: Use image node_id 2 for calling a global function with example usage: evaluate(hook_dict, ckpt, saver, best_iou, hparams) and returns: summary,  global_step