class_docstr: A driver for running eval inference.
  
  Attributes:
    model_name: str. Model name to eval.
    batch_size: int. Eval batch size.
    image_size: int. Input image size, determined by model name.
    num_classes: int. Number of classes, default to 1000 for ImageNet.
    include_background_label: whether to include extra background label.
class_docstr_tok: ["A","driver","for","running","eval","inference",".","Attributes",":","model_name",":","str",".","Model","name","to","eval",".","batch_size",":","int",".","Eval","batch","size",".","image_size",":","int",".","Input","image","size",",","determined","by","model","name",".","num_classes",":","int",".","Number","of","classes",",","default","to","1000","for","ImageNet",".","include_background_label",":","whether","to","include","extra","background","label","."]
docstr: Eval ImageNet images and report top1/top5 accuracy.
  
  Args:
    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.
    enable_ema: enable expotential moving average.
    export_ckpt: export checkpoint folder.
  
  Returns:
    A tuple (top1, top5) for top1 and top5 accuracy.
docstr_tok: ["Eval","ImageNet","images","and","report","top1\/top5","accuracy",".","Args",":","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",".","enable_ema",":","enable","expotential","moving","average",".","export_ckpt",":","export","checkpoint","folder",".","Returns",":","A","tuple","(","top1",",","top5",")","for","top1","and","top5","accuracy","."]
code: def eval_imagenet(
      self,
      ckpt_dir,
      imagenet_eval_glob,
      imagenet_eval_label,
      num_images,
      enable_ema,
      export_ckpt,
  ):
      """Eval ImageNet images and report top1/top5 accuracy.
  
      Args:
        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.
        enable_ema: enable expotential moving average.
        export_ckpt: export checkpoint folder.
  
      Returns:
        A tuple (top1, top5) for top1 and top5 accuracy.
      """
      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, _ = self.run_inference(
          ckpt_dir, image_files, labels, enable_ema, export_ckpt
      )
      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 os
  import sys
  from absl import logging
  import numpy
  import tensorflow.compat.v1
  from tensorflow.python.tpu import tpu_function
label_desc: Use image node_id 8 for calling the EvalCkptDriver obj's underlying member method code with example usage: obj.eval_imagenet(ckpt_dir, imagenet_eval_glob, imagenet_eval_label, num_images, enable_ema, export_ckpt) and returns: top1,  top5