code: def __init__(self, args):
      self.ocr_engine = PaddleOCR(
          use_angle_cls=args.use_angle_cls,
          det_model_dir=args.det_model_dir,
          rec_model_dir=args.rec_model_dir,
          show_log=False,
          use_gpu=args.use_gpu,
      )
  
      pre_process_list = [
          {
              "VQATokenLabelEncode": {
                  "algorithm": args.kie_algorithm,
                  "class_path": args.ser_dict_path,
                  "contains_re": False,
                  "ocr_engine": self.ocr_engine,
                  "order_method": args.ocr_order_method,
              }
          },
          {
              "VQATokenPad": {
                  "max_seq_len": 512,
                  "return_attention_mask": True,
              }
          },
          {
              "VQASerTokenChunk": {
                  "max_seq_len": 512,
                  "return_attention_mask": True,
              }
          },
          {"Resize": {"size": [224, 224]}},
          {
              "NormalizeImage": {
                  "std": [58.395, 57.12, 57.375],
                  "mean": [123.675, 116.28, 103.53],
                  "scale": "1",
                  "order": "hwc",
              }
          },
          {"ToCHWImage": None},
          {
              "KeepKeys": {
                  "keep_keys": [
                      "input_ids",
                      "bbox",
                      "attention_mask",
                      "token_type_ids",
                      "image",
                      "labels",
                      "segment_offset_id",
                      "ocr_info",
                      "entities",
                  ]
              }
          },
      ]
      postprocess_params = {
          "name": "VQASerTokenLayoutLMPostProcess",
          "class_path": args.ser_dict_path,
      }
  
      self.preprocess_op = create_operators(
          pre_process_list, {"infer_mode": True}
      )
      self.postprocess_op = build_post_process(postprocess_params)
      (
          self.predictor,
          self.input_tensor,
          self.output_tensors,
          self.config,
      ) = utility.create_predictor(args, "ser", logger)
  
file_path: PaddleOCR/ppstructure/kie/predict_kie_token_ser.py
imports: import os
  import sys
  import cv2
  import json
  import numpy
  import time
  import tools.infer.utility
  from ppocr.data import create_operators, transform
  from ppocr.postprocess import build_post_process
  from ppocr.utils.logging import get_logger
  from ppocr.utils.visual import draw_ser_results
  from ppocr.utils.utility import get_image_file_list, check_and_read
  from ppstructure.utility import parse_args
  from paddleocr import PaddleOCR
label_desc: Use image node_id 1 to create a new SerPredictor object from inherited base classes: object with example: obj = SerPredictor(args)