code: def eval_imagenet(
      model_name,
      ckpt_dir,
      imagenet_eval_glob,
      imagenet_eval_label,
      num_images,
  ):
      """Eval ImageNet images and report top1/top5 accuracy.
  
      Args:
        model_name: str. The name of model to eval.
        ckpt_dir: str. Checkpoint directory path.
        imagenet_eval_glob: str. File path glob for all eval images.
        imagenet_eval_label: str. File path for eval label.
        num_images: int. Number of images to eval: -1 means eval the whole dataset.
  
      Returns:
        A tuple (top1, top5) for top1 and top5 accuracy.
      """
      eval_ckpt_driver = EvalCkptDriver(model_name)
      imagenet_val_labels = [
          int(i) for i in tf.gfile.GFile(imagenet_eval_label)
      ]
      imagenet_filenames = sorted(tf.gfile.Glob(imagenet_eval_glob))
      if num_images < 0:
          num_images = len(imagenet_filenames)
      image_files = imagenet_filenames[:num_images]
      labels = imagenet_val_labels[:num_images]
  
      pred_idx, _ = eval_ckpt_driver.run_inference(
          ckpt_dir, image_files, labels
      )
      top1_cnt, top5_cnt = 0.0, 0.0
      for i, label in enumerate(labels):
          top1_cnt += label in pred_idx[i][:1]
          top5_cnt += label in pred_idx[i][:5]
          if i % 100 == 0:
              print(
                  "Step {}: top1_acc = {:4.2f}%  top5_acc = {:4.2f}%".format(
                      i,
                      100 * top1_cnt / (i + 1),
                      100 * top5_cnt / (i + 1),
                  )
              )
              sys.stdout.flush()
      top1, top5 = (
          100 * top1_cnt / num_images,
          100 * top5_cnt / num_images,
      )
      print(
          "Final: top1_acc = {:4.2f}%  top5_acc = {:4.2f}%".format(
              top1, top5
          )
      )
      return top1, top5
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import sys
  from absl import app
  from absl import flags
  import numpy
  import tensorflow
  import efficientnet_builder
  import preprocessing
label_desc: Use image node_id 2 for calling a global function with example usage: eval_imagenet(model_name, ckpt_dir, imagenet_eval_glob, imagenet_eval_label, num_images) and returns: top1,  top5