code: def paddle_inference(args):
      import paddle.inference as paddle_infer
  
      config = init_paddle_inference_config(args)
      predictor = paddle_infer.create_predictor(config)
  
      input_names = predictor.get_input_names()
      input_handle = predictor.get_input_handle(input_names[0])
  
      if args.benchmark:
          import auto_log
  
          pid = os.getpid()
          autolog = auto_log.AutoLogger(
              model_name="det",
              model_precision="fp32",
              batch_size=1,
              data_shape="dynamic",
              save_path="./output/auto_log.log",
              inference_config=config,
              pids=pid,
              process_name=None,
              gpu_ids=0,
              time_keys=[
                  "preprocess_time",
                  "inference_time",
                  "postprocess_time",
              ],
              warmup=0,
          )
          img = np.random.uniform(0, 255, [1, 3, 112, 112]).astype(
              np.float32
          )
          input_handle.copy_from_cpu(img)
          for i in range(10):
              predictor.run()
  
      img_list = get_image_file_list(args.image_path)
      for img_path in img_list:
          img = cv2.imread(img_path)
          st = time.time()
          if args.benchmark:
              autolog.times.start()
  
          # normalize to mean 0.5, std 0.5
          img = (img - 127.5) * 0.00784313725
          # BGR2RGB
          img = img[:, :, ::-1]
          img = img.transpose((2, 0, 1))
          img = np.expand_dims(img, 0)
          img = img.astype("float32")
  
          if args.benchmark:
              autolog.times.stamp()
  
          input_handle.copy_from_cpu(img)
  
          predictor.run()
  
          output_names = predictor.get_output_names()
          output_handle = predictor.get_output_handle(output_names[0])
          output_data = output_handle.copy_to_cpu()
          if args.benchmark:
              autolog.times.stamp()
              autolog.times.end(stamp=True)
              print(
                  "{}\t{}".format(
                      img_path, json.dumps(output_data.tolist())
                  )
              )
          print("paddle inference result: ", output_data.shape)
      if args.benchmark:
          autolog.report()
  
file_path: insightface/recognition/arcface_paddle/tools/inference.py
imports: import sys
  import os
  import cv2
  import time
  import json
  import argparse
  import numpy
label_desc: Use image node_id 6 for calling a global function with example usage: paddle_inference(args) without return types