PP-OCRv3-IE.yml 2.0 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80
ENV:
  min_subgraph_size: 3
  trt_calib_mode: False
  cpu_threads: 1
  trt_use_static: False
  save_img: True
  save_res: True
  return_res: True

MODEL:
  - OcrDbDetOp:
      name: det
      param_path: paddlecv://models/ch_PP-OCRv3_det_infer/inference.pdiparams
      model_path: paddlecv://models/ch_PP-OCRv3_det_infer/inference.pdmodel
      batch_size: 1
      PreProcess:
        - RGB2BGR:
        - DetResizeForTest:
            limit_side_len: 960
            limit_type: "max"
        - NormalizeImage:
            std: [0.229, 0.224, 0.225]
            mean: [0.485, 0.456, 0.406]
            scale: '1./255.'
            order: 'hwc'
        - ToCHWImage:
        - ExpandDim:
            axis: 0
        - KeepKeys:
            keep_keys: ['image', 'shape']
      PostProcess:
        - DBPostProcess:
            thresh: 0.3
            box_thresh: 0.6
            max_candidates: 1000
            unclip_ratio: 1.5
            use_dilation: False
            score_mode: "fast"
            box_type: "quad"
      Inputs:
        - input.image
  - PolyCropOp:
      name: crop
      Inputs:
        - input.image
        - det.dt_polys
  - OcrCrnnRecOp:
      name: rec
      param_path: paddlecv://models/ch_PP-OCRv3_rec_infer/inference.pdiparams
      model_path: paddlecv://models/ch_PP-OCRv3_rec_infer/inference.pdmodel
      batch_size: 6
      PreProcess:
        - RGB2BGR:
        - ReisizeNormImg:
            rec_image_shape: [3, 48, 320]
      PostProcess:
        - CTCLabelDecode:
            character_dict_path: "paddlecv://dict/ocr/ch_dict.txt"
            use_space_char: true
      Inputs:
        - crop.crop_image
  - InformationExtractionOp:
      name: nlp
      schema: ['时间', '始发站', '终点站']
      batch_size: 1
      PostProcess:
        - InformationExtractionDecode:
      Inputs:
        - rec.rec_text
  - OCROutput:
      name: vis
      font_path: paddlecv://fonts/simfang.ttf
      Inputs:
        - input.fn
        - input.image
        - det.dt_polys
        - rec.rec_text
        - rec.rec_score
        - nlp.text
        - nlp.type