code: def eval_test_images(
      loaded_model,
      output_file,
      test_map_file,
      image_width,
      image_height,
      max_images=-1,
      column_offset=0,
  ):
      num_images = sum(1 for line in open(test_map_file))
      if max_images > 0:
          num_images = min(num_images, max_images)
      print(
          "Evaluating model output node '{0}' for {1} images.".format(
              new_output_node_name, num_images
          )
      )
  
      pred_count = 0
      correct_count = 0
      np.seterr(over="raise")
      with open(output_file, "wb") as results_file:
          with open(test_map_file, "r") as input_file:
              for line in input_file:
                  tokens = line.rstrip().split("\t")
                  img_file = tokens[0 + column_offset]
                  probs = eval_single_image(
                      loaded_model, img_file, image_width, image_height
                  )
  
                  pred_count += 1
                  true_label = int(tokens[1 + column_offset])
                  predicted_label = np.argmax(probs)
                  if predicted_label == true_label:
                      correct_count += 1
  
                  np.savetxt(
                      results_file, probs[np.newaxis], fmt="%.3f"
                  )
                  if pred_count % 100 == 0:
                      print(
                          "Processed {0} samples ({1} correct)".format(
                              pred_count,
                              (float(correct_count) / pred_count),
                          )
                      )
                  if pred_count >= num_images:
                      break
  
      print(
          "{0} out of {1} predictions were correct {2}.".format(
              correct_count,
              pred_count,
              (float(correct_count) / pred_count),
          )
      )
  
imports: from __future__ import print_function
  import numpy
  import cntk
  import os
  from PIL import Image
  from cntk.device import try_set_default_device, gpu
  from cntk import load_model, placeholder, Constant
  from cntk import Trainer
  from cntk.logging.graph import find_by_name, get_node_outputs
  from cntk.io import MinibatchSource, ImageDeserializer, StreamDefs, StreamDef
  import cntk.io.transforms
  from cntk.layers import Dense
  from cntk.learners import momentum_sgd, learning_parameter_schedule, momentum_schedule
  from cntk.ops import combine, softmax
  from cntk.ops.functions import CloneMethod
  from cntk.losses import cross_entropy_with_softmax
  from cntk.metrics import classification_error
  from cntk.logging import log_number_of_parameters, ProgressPrinter
label_desc: Use image node_id 5 for calling a global function with example usage: eval_test_images(loaded_model, output_file, test_map_file, image_width, image_height, max_images, column_offset) without return types