code: def get_test_images(infer_dir, infer_img):
      """
      Get image path list in TEST mode
      """
      assert (
          infer_img is not None or infer_dir is not None
      ), "--image_file or --image_dir should be set"
      assert infer_img is None or os.path.isfile(
          infer_img
      ), "{} is not a file".format(infer_img)
      assert infer_dir is None or os.path.isdir(
          infer_dir
      ), "{} is not a directory".format(infer_dir)
  
      # infer_img has a higher priority
      if infer_img and os.path.isfile(infer_img):
          return [infer_img]
  
      images = set()
      infer_dir = os.path.abspath(infer_dir)
      assert os.path.isdir(
          infer_dir
      ), "infer_dir {} is not a directory".format(infer_dir)
      exts = ["jpg", "jpeg", "png", "bmp"]
      exts += [ext.upper() for ext in exts]
      for ext in exts:
          images.update(glob.glob("{}/*.{}".format(infer_dir, ext)))
      images = list(images)
  
      assert len(images) > 0, "no image found in {}".format(infer_dir)
      print("Found {} inference images in total.".format(len(images)))
  
      return images
  
imports: import time
  import numpy
  import pycuda.autoinit
  import pycuda.driver
  import tensorrt
  from collections import OrderedDict
  import os
  import yaml
  import json
  import glob
  import argparse
  from preprocess import Compose
  from preprocess import coco_clsid2catid
label_desc: Use image node_id 1 for calling a global function with example usage: get_test_images(infer_dir, infer_img) and returns: images, list