docstr: 初始化模型
  :param model_path: 模型地址(可以是模型的参数或者参数和计算图一起保存的文件)
  :param gpu_id: 在哪一块gpu上运行
docstr_tok: ["\u521d\u59cb\u5316\u6a21\u578b",":","param","model_path",":","\u6a21\u578b\u5730\u5740","(","\u53ef\u4ee5\u662f\u6a21\u578b\u7684\u53c2\u6570\u6216\u8005\u53c2\u6570\u548c\u8ba1\u7b97\u56fe\u4e00\u8d77\u4fdd\u5b58\u7684\u6587\u4ef6",")",":","param","gpu_id",":","\u5728\u54ea\u4e00\u5757gpu\u4e0a\u8fd0\u884c"]
code: def __init__(self, model_path, post_p_thre=0.7, gpu_id=None):
      """
      初始化模型
      :param model_path: 模型地址(可以是模型的参数或者参数和计算图一起保存的文件)
      :param gpu_id: 在哪一块gpu上运行
      """
      self.gpu_id = gpu_id
  
      if (
          self.gpu_id is not None
          and isinstance(self.gpu_id, int)
          and paddle.device.is_compiled_with_cuda()
      ):
          paddle.device.set_device("gpu:{}".format(self.gpu_id))
      else:
          paddle.device.set_device("cpu")
      checkpoint = paddle.load(model_path)
  
      config = checkpoint["config"]
      config["arch"]["backbone"]["pretrained"] = False
      self.model = build_model(config["arch"])
      self.post_process = get_post_processing(config["post_processing"])
      self.post_process.box_thresh = post_p_thre
      self.img_mode = config["dataset"]["train"]["dataset"]["args"][
          "img_mode"
      ]
      self.model.set_state_dict(checkpoint["state_dict"])
      self.model.eval()
  
      self.transform = []
      for t in config["dataset"]["train"]["dataset"]["args"][
          "transforms"
      ]:
          if t["type"] in ["ToTensor", "Normalize"]:
              self.transform.append(t)
      self.transform = get_transforms(self.transform)
  
file_path: PaddleOCR/benchmark/PaddleOCR_DBNet/tools/predict.py
imports: import os
  import sys
  import pathlib
  import time
  import cv2
  import paddle
  from data_loader import get_transforms
  from models import build_model
  from post_processing import get_post_processing
label_desc: Use image node_id 1 to create a new PaddleModel object  with example: obj = PaddleModel(model_path, post_p_thre, gpu_id)