class_docstr: Args:
      model_dir (str): root path of model.pdiparams, model.pdmodel and infer_cfg.yml
      device (str): Choose the device you want to run, it can be: CPU/GPU/XPU/NPU, default is CPU
      run_mode (str): mode of running(paddle/trt_fp32/trt_fp16)
      batch_size (int): size of pre batch in inference
      trt_min_shape (int): min shape for dynamic shape in trt
      trt_max_shape (int): max shape for dynamic shape in trt
      trt_opt_shape (int): opt shape for dynamic shape in trt
      trt_calib_mode (bool): If the model is produced by TRT offline quantitative
          calibration, trt_calib_mode need to set True
      cpu_threads (int): cpu threads
      enable_mkldnn (bool): whether to open MKLDNN
      output_dir (str): The path of output
      threshold (float): The threshold of score for visualization
class_docstr_tok: ["Args",":","model_dir","(","str",")",":","root","path","of","model.pdiparams",",","model.pdmodel","and","infer_cfg.yml","device","(","str",")",":","Choose","the","device","you","want","to","run",",","it","can","be",":","CPU\/GPU\/XPU\/NPU",",","default","is","CPU","run_mode","(","str",")",":","mode","of","running","(","paddle\/trt_fp32\/trt_fp16",")","batch_size","(","int",")",":","size","of","pre","batch","in","inference","trt_min_shape","(","int",")",":","min","shape","for","dynamic","shape","in","trt","trt_max_shape","(","int",")",":","max","shape","for","dynamic","shape","in","trt","trt_opt_shape","(","int",")",":","opt","shape","for","dynamic","shape","in","trt","trt_calib_mode","(","bool",")",":","If","the","model","is","produced","by","TRT","offline","quantitative","calibration",",","trt_calib_mode","need","to","set","True","cpu_threads","(","int",")",":","cpu","threads","enable_mkldnn","(","bool",")",":","whether","to","open","MKLDNN","output_dir","(","str",")",":","The","path","of","output","threshold","(","float",")",":","The","threshold","of","score","for","visualization"]
code: def predict_image(
      self, image_list, run_benchmark=False, repeats=1, visual=True
  ):
      batch_loop_cnt = math.ceil(
          float(len(image_list)) / self.batch_size
      )
      results = []
      for i in range(batch_loop_cnt):
          start_index = i * self.batch_size
          end_index = min((i + 1) * self.batch_size, len(image_list))
          batch_image_list = image_list[start_index:end_index]
          if run_benchmark:
              # preprocess
              inputs = self.preprocess(batch_image_list)  # warmup
              self.det_times.preprocess_time_s.start()
              inputs = self.preprocess(batch_image_list)
              self.det_times.preprocess_time_s.end()
  
              # model prediction
              result = self.predict(repeats=repeats)  # warmup
              self.det_times.inference_time_s.start()
              result = self.predict(repeats=repeats)
              self.det_times.inference_time_s.end(repeats=repeats)
  
              # postprocess
              result_warmup = self.postprocess(inputs, result)  # warmup
              self.det_times.postprocess_time_s.start()
              result = self.postprocess(inputs, result)
              self.det_times.postprocess_time_s.end()
              self.det_times.img_num += len(batch_image_list)
  
              cm, gm, gu = get_current_memory_mb()
              self.cpu_mem += cm
              self.gpu_mem += gm
              self.gpu_util += gu
          else:
              # preprocess
              self.det_times.preprocess_time_s.start()
              inputs = self.preprocess(batch_image_list)
              self.det_times.preprocess_time_s.end()
  
              # model prediction
              self.det_times.inference_time_s.start()
              result = self.predict()
              self.det_times.inference_time_s.end()
  
              # postprocess
              self.det_times.postprocess_time_s.start()
              result = self.postprocess(inputs, result)
              self.det_times.postprocess_time_s.end()
              self.det_times.img_num += len(batch_image_list)
  
              if visual:
                  visualize(
                      batch_image_list,
                      result,
                      output_dir=self.output_dir,
                  )
  
          results.append(result)
          if visual:
              print("Test iter {}".format(i))
  
      results = self.merge_batch_result(results)
      return results
  
imports: import os
  import yaml
  import glob
  from functools import reduce
  import cv2
  import numpy
  import math
  import paddle
  from paddle.inference import Config
  from paddle.inference import create_predictor
  import sys
  from python.benchmark_utils import PaddleInferBenchmark
  from python.preprocess import preprocess, Resize, NormalizeImage, Permute, PadStride, LetterBoxResize, WarpAffine
  from python.visualize import visualize_attr
  from python.utils import argsparser, Timer, get_current_memory_mb
  from python.infer import Detector, get_test_images, print_arguments, load_predictor
  from PIL import Image, ImageDraw, ImageFont
label_desc: Use image node_id 6 for calling the AttrDetector obj's underlying member method code with example usage: obj.predict_image(image_list, run_benchmark, repeats, visual) and returns: results