code: def eval_single_image(
      loaded_model, image_path, image_width, image_height
  ):
      # load and format image (resize, RGB -> BGR, CHW -> HWC)
      img = Image.open(image_path)
      if image_path.endswith("png"):
          temp = Image.new("RGB", img.size, (255, 255, 255))
          temp.paste(img, img)
          img = temp
      resized = img.resize((image_width, image_height), Image.ANTIALIAS)
      bgr_image = np.asarray(resized, dtype=np.float32)[..., [2, 1, 0]]
      hwc_format = np.ascontiguousarray(np.rollaxis(bgr_image, 2))
  
      ## Alternatively: if you want to use opencv-python
      # cv_img = cv2.imread(image_path)
      # resized = cv2.resize(cv_img, (image_width, image_height), interpolation=cv2.INTER_NEAREST)
      # bgr_image = np.asarray(resized, dtype=np.float32)
      # hwc_format = np.ascontiguousarray(np.rollaxis(bgr_image, 2))
  
      # compute model output
      arguments = {loaded_model.arguments[0]: [hwc_format]}
      output = loaded_model.eval(arguments)
  
      # return softmax probabilities
      sm = softmax(output[0])
      return sm.eval()
  
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 4 for calling a global function with example usage: eval_single_image(loaded_model, image_path, image_width, image_height) and returns: sm