code: def __init__(self, config):
      global_config = config["Global"]
      self.algorithm = config["Architecture"]["algorithm"]
  
      # build post process
      self.post_process_class = build_post_process(
          config["PostProcess"], global_config
      )
  
      # build model
      self.model = build_model(config["Architecture"])
  
      load_model(
          config,
          self.model,
          model_type=config["Architecture"]["model_type"],
      )
  
      from paddleocr import PaddleOCR
  
      self.ocr_engine = PaddleOCR(
          use_angle_cls=False,
          show_log=False,
          rec_model_dir=global_config.get("kie_rec_model_dir", None),
          det_model_dir=global_config.get("kie_det_model_dir", None),
          use_gpu=global_config["use_gpu"],
      )
  
      # create data ops
      transforms = []
      for op in config["Eval"]["dataset"]["transforms"]:
          op_name = list(op)[0]
          if "Label" in op_name:
              op[op_name]["ocr_engine"] = self.ocr_engine
          elif op_name == "KeepKeys":
              op[op_name]["keep_keys"] = [
                  "input_ids",
                  "bbox",
                  "attention_mask",
                  "token_type_ids",
                  "image",
                  "labels",
                  "segment_offset_id",
                  "ocr_info",
                  "entities",
              ]
  
          transforms.append(op)
      if config["Global"].get("infer_mode", None) is None:
          global_config["infer_mode"] = True
      self.ops = create_operators(
          config["Eval"]["dataset"]["transforms"], global_config
      )
      self.model.eval()
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import numpy
  import os
  import sys
  import cv2
  import json
  import paddle
  from ppocr.data import create_operators, transform
  from ppocr.modeling.architectures import build_model
  from ppocr.postprocess import build_post_process
  from ppocr.utils.save_load import load_model
  from ppocr.utils.visual import draw_ser_results
  from ppocr.utils.utility import get_image_file_list, load_vqa_bio_label_maps
  import tools.program
label_desc: Use image node_id 1 to create a new SerPredictor object from inherited base classes: object with example: obj = SerPredictor(config)