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: Build and run inference on the target images and labels.
docstr_tok: ["Build","and","run","inference","on","the","target","images","and","labels","."]
code: def run_inference(
      self,
      ckpt_dir,
      image_files,
      labels,
      enable_ema=True,
      export_ckpt=None,
  ):
      """Build and run inference on the target images and labels."""
      label_offset = 1 if self.include_background_label else 0
      with tf.Graph().as_default(), tf.Session() as sess:
          images, labels = self.build_dataset(
              image_files, labels, False
          )
          probs = self.build_model(images, is_training=False)
          if isinstance(probs, tuple):
              probs = probs[0]
  
          self.restore_model(sess, ckpt_dir, enable_ema, export_ckpt)
  
          prediction_idx = []
          prediction_prob = []
          for _ in range(len(image_files) // self.batch_size):
              out_probs = sess.run(probs)
              idx = np.argsort(out_probs)[::-1]
              prediction_idx.append(idx[:5] - label_offset)
              prediction_prob.append(
                  [out_probs[pid] for pid in idx[:5]]
              )
  
          # Return the top 5 predictions (idx and prob) for each image.
          return prediction_idx, prediction_prob
  
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 6 for calling the EvalCkptDriver obj's underlying member method code with example usage: obj.run_inference(ckpt_dir, image_files, labels, enable_ema, export_ckpt) and returns: prediction_idx,  prediction_prob