code: def main(args):
      image_file_list = get_image_file_list(args.image_dir)
      text_classifier = TextClassifier(args)
      valid_image_file_list = []
      img_list = []
      for image_file in image_file_list:
          img, flag, _ = check_and_read(image_file)
          if not flag:
              img = cv2.imread(image_file)
          if img is None:
              logger.info(
                  "error in loading image:{}".format(image_file)
              )
              continue
          valid_image_file_list.append(image_file)
          img_list.append(img)
      try:
          img_list, cls_res, predict_time = text_classifier(img_list)
      except Exception as E:
          logger.info(traceback.format_exc())
          logger.info(E)
          exit()
      for ino in range(len(img_list)):
          logger.info(
              "Predicts of {}:{}".format(
                  valid_image_file_list[ino], cls_res[ino]
              )
          )
  
file_path: PaddleOCR/tools/infer/predict_cls.py
imports: import os
  import sys
  import cv2
  import copy
  import numpy
  import math
  import time
  import traceback
  import tools.infer.utility
  from ppocr.postprocess import build_post_process
  from ppocr.utils.logging import get_logger
  from ppocr.utils.utility import get_image_file_list, check_and_read
label_desc: Use image node_id 1 for calling a global function with example usage: main(args) without return types