class_docstr: InferenceEngine
  
  Inference engina class which contains preprocess, run, postprocess
class_docstr_tok: ["InferenceEngine","Inference","engina","class","which","contains","preprocess",",","run",",","postprocess"]
docstr: Args:
      args: Parameters generated using argparser.
  Returns: None
docstr_tok: ["Args",":","args",":","Parameters","generated","using","argparser",".","Returns",":","None"]
code: def __init__(self, args):
      """
      Args:
          args: Parameters generated using argparser.
      Returns: None
      """
      super().__init__()
      self.args = args
  
      # init inference engine
      (
          self.predictor,
          self.config,
          self.input_tensor,
          self.output_tensor,
      ) = self.load_predictor(
          os.path.join(args.model_dir, "inference.pdmodel"),
          os.path.join(args.model_dir, "inference.pdiparams"),
      )
  
      # build transforms
      self.transforms = transforms.Compose(
          [
              transforms.ToTensor(),
              transforms.Normalize(
                  mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]
              ),
          ]
      )
  
      # wamrup
      if self.args.warmup > 0:
          for idx in range(args.warmup):
              print(idx)
              x = np.random.rand(
                  1, 3, self.args.crop_size, self.args.crop_size
              ).astype("float32")
              self.input_tensor.copy_from_cpu(x)
              self.predictor.run()
              self.output_tensor.copy_to_cpu()
  
      self.post_process = get_post_processing(
          {
              "type": "SegDetectorRepresenter",
              "args": {
                  "thresh": 0.3,
                  "box_thresh": 0.7,
                  "max_candidates": 1000,
                  "unclip_ratio": 1.5,
              },
          }
      )
  
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 1 to create a new InferenceEngine object from inherited base classes: object with example: obj = InferenceEngine(args)