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
      ), "--infer_img or --infer_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)
      logger.info(
          "Found {} inference images in total.".format(len(images))
      )
  
      return images
  
file_path: PaddleDetection/tools/infer_culane.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import os
  import sys
  import warnings
  import glob
  import ast
  import paddle
  from ppdet.core.workspace import load_config, merge_config
  from ppdet.engine import Trainer
  from ppdet.utils.check import check_gpu, check_npu, check_xpu, check_mlu, check_version, check_config
  from ppdet.utils.cli import ArgsParser, merge_args
  from ppdet.slim import build_slim_model
  from ppdet.utils.logger import setup_logger
label_desc: Use image node_id 2 for calling a global function with example usage: get_test_images(infer_dir, infer_img) and returns: images, list