class_docstr: InferenceEngine
  
  Inference engina class which contains preprocess, run, postprocess
class_docstr_tok: ["InferenceEngine","Inference","engina","class","which","contains","preprocess",",","run",",","postprocess"]
docstr: load_predictor
  initialize the inference engine
  Args:
      model_file_path: inference model path (*.pdmodel)
      model_file_path: inference parmaeter path (*.pdiparams)
  Return:
      predictor: Predictor created using Paddle Inference.
      config: Configuration of the predictor.
      input_tensor: Input tensor of the predictor.
      output_tensor: Output tensor of the predictor.
docstr_tok: ["load_predictor","initialize","the","inference","engine","Args",":","model_file_path",":","inference","model","path","(","*",".pdmodel",")","model_file_path",":","inference","parmaeter","path","(","*",".pdiparams",")","Return",":","predictor",":","Predictor","created","using","Paddle","Inference",".","config",":","Configuration","of","the","predictor",".","input_tensor",":","Input","tensor","of","the","predictor",".","output_tensor",":","Output","tensor","of","the","predictor","."]
code: def load_predictor(self, model_file_path, params_file_path):
      """load_predictor
      initialize the inference engine
      Args:
          model_file_path: inference model path (*.pdmodel)
          model_file_path: inference parmaeter path (*.pdiparams)
      Return:
          predictor: Predictor created using Paddle Inference.
          config: Configuration of the predictor.
          input_tensor: Input tensor of the predictor.
          output_tensor: Output tensor of the predictor.
      """
      args = self.args
      config = inference.Config(model_file_path, params_file_path)
      if args.use_gpu:
          config.enable_use_gpu(1000, 0)
          if args.use_tensorrt:
              config.enable_tensorrt_engine(
                  workspace_size=1 << 30,
                  precision_mode=precision,
                  max_batch_size=args.max_batch_size,
                  min_subgraph_size=args.min_subgraph_size,  # skip the minmum trt subgraph
                  use_calib_mode=False,
              )
  
              # collect shape
              trt_shape_f = os.path.join(
                  model_dir, "_trt_dynamic_shape.txt"
              )
  
              if not os.path.exists(trt_shape_f):
                  config.collect_shape_range_info(trt_shape_f)
                  logger.info(
                      f"collect dynamic shape info into : {trt_shape_f}"
                  )
              try:
                  config.enable_tuned_tensorrt_dynamic_shape(
                      trt_shape_f, True
                  )
              except Exception as E:
                  logger.info(E)
                  logger.info(
                      "Please keep your paddlepaddle-gpu >= 2.3.0!"
                  )
      else:
          config.disable_gpu()
          # The thread num should not be greater than the number of cores in the CPU.
          if args.enable_mkldnn:
              # cache 10 different shapes for mkldnn to avoid memory leak
              config.set_mkldnn_cache_capacity(10)
              config.enable_mkldnn()
              if args.precision == "fp16":
                  config.enable_mkldnn_bfloat16()
              if hasattr(args, "cpu_threads"):
                  config.set_cpu_math_library_num_threads(
                      args.cpu_threads
                  )
              else:
                  # default cpu threads as 10
                  config.set_cpu_math_library_num_threads(10)
  
      # enable memory optim
      config.enable_memory_optim()
      config.disable_glog_info()
  
      config.switch_use_feed_fetch_ops(False)
      config.switch_ir_optim(True)
  
      # create predictor
      predictor = inference.create_predictor(config)
  
      # get input and output tensor property
      input_names = predictor.get_input_names()
      input_tensor = predictor.get_input_handle(input_names[0])
  
      output_names = predictor.get_output_names()
      output_tensor = predictor.get_output_handle(output_names[0])
  
      return predictor, config, input_tensor, output_tensor
  
imports: import os
  import sys
  import pathlib
  import cv2
  import paddle
  from paddle import inference
  import numpy
  from PIL import Image
  from paddle.vision import transforms
  from tools.predict import resize_image
  from post_processing import get_post_processing
  from utils.util import draw_bbox, save_result
label_desc: Use image node_id 2 for calling the InferenceEngine obj's underlying member method code with example usage: obj.load_predictor(model_file_path, params_file_path) and returns: predictor,  config,  input_tensor,  output_tensor