code: def get_image_list(image_path):
      """Get image list"""
      valid_suffix = [
          ".JPEG",
          ".jpeg",
          ".JPG",
          ".jpg",
          ".BMP",
          ".bmp",
          ".PNG",
          ".png",
      ]
      image_list = []
      image_dir = None
      if os.path.isfile(image_path):
          if os.path.splitext(image_path)[-1] in valid_suffix:
              image_list.append(image_path)
      elif os.path.isdir(image_path):
          image_dir = image_path
          for root, dirs, files in os.walk(image_path):
              for f in files:
                  if ".ipynb_checkpoints" in root:
                      continue
                  if os.path.splitext(f)[-1] in valid_suffix:
                      image_list.append(os.path.join(root, f))
      else:
          raise FileNotFoundError(
              "`--image_path` is not found. it should be an image file or a directory including images"
          )
  
      if len(image_list) == 0:
          raise RuntimeError(
              "There are not image file in `--image_path`"
          )
  
      return image_list, image_dir
  
file_path: PaddleSeg/contrib/PanopticDeepLab/predict.py
imports: import argparse
  import os
  import paddle
  from paddleseg.cvlibs import manager, Config
  from paddleseg.utils import get_sys_env, logger
  from core import predict
  from datasets import CityscapesPanoptic
  from models import PanopticDeepLab
label_desc: Use image node_id 2 for calling a global function with example usage: get_image_list(image_path) and returns: image_list,  image_dir