table_master.yml 3.7 KB
Newer Older
文幕地方's avatar
文幕地方 已提交
1 2 3 4
Global:
  use_gpu: true
  epoch_num: 17
  log_smooth_window: 20
文幕地方's avatar
add ref  
文幕地方 已提交
5
  print_batch_step: 100
文幕地方's avatar
文幕地方 已提交
6 7
  save_model_dir: ./output/table_master/
  save_epoch_step: 17
文幕地方's avatar
add ref  
文幕地方 已提交
8 9 10
  eval_batch_step: [0,  6259]
  cal_metric_during_train: true
  pretrained_model: null
11
  checkpoints:
文幕地方's avatar
add ref  
文幕地方 已提交
12 13
  save_inference_dir: output/table_master/infer
  use_visualdl: false
文幕地方's avatar
文幕地方 已提交
14
  infer_img: ppstructure/docs/table/table.jpg
文幕地方's avatar
add ref  
文幕地方 已提交
15
  save_res_path: ./output/table_master
文幕地方's avatar
文幕地方 已提交
16
  character_dict_path: ppocr/utils/dict/table_master_structure_dict.txt
文幕地方's avatar
add ref  
文幕地方 已提交
17
  infer_mode: false
文幕地方's avatar
文幕地方 已提交
18 19
  max_text_length: &max_text_length 500
  box_format: &box_format 'xywh' # 'xywh', 'xyxy', 'xyxyxyxy'
20
  d2s_train_image_shape: [3, 480, 480]
文幕地方's avatar
文幕地方 已提交
21 22 23 24 25 26 27 28 29 30 31 32 33


Optimizer:
  name: Adam
  beta1: 0.9
  beta2: 0.999
  lr:
    name: MultiStepDecay
    learning_rate: 0.001
    milestones: [12, 15]
    gamma: 0.1
    warmup_epoch: 0.02
  regularizer:
文幕地方's avatar
add ref  
文幕地方 已提交
34 35
    name: L2
    factor: 0.0
文幕地方's avatar
文幕地方 已提交
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54

Architecture:
  model_type: table
  algorithm: TableMaster
  Backbone:
    name: TableResNetExtra
    gcb_config:
      ratio: 0.0625
      headers: 1
      att_scale: False
      fusion_type: channel_add
      layers: [False, True, True, True]
    layers: [1,2,5,3]
  Head:
    name: TableMasterHead
    hidden_size: 512
    headers: 8
    dropout: 0
    d_ff: 2024
文幕地方's avatar
文幕地方 已提交
55 56
    max_text_length: *max_text_length
    loc_reg_num: &loc_reg_num 4
文幕地方's avatar
文幕地方 已提交
57 58 59 60 61 62 63 64

Loss:
  name: TableMasterLoss
  ignore_index: 42 # set to len of dict + 3

PostProcess:
  name: TableMasterLabelDecode
  box_shape: pad
65
  merge_no_span_structure: &merge_no_span_structure True
文幕地方's avatar
文幕地方 已提交
66 67 68 69

Metric:
  name: TableMetric
  main_indicator: acc
文幕地方's avatar
add ref  
文幕地方 已提交
70
  compute_bbox_metric: False
文幕地方's avatar
文幕地方 已提交
71
  box_format: *box_format
文幕地方's avatar
文幕地方 已提交
72 73 74 75

Train:
  dataset:
    name: PubTabDataSet
文幕地方's avatar
add ref  
文幕地方 已提交
76 77
    data_dir: train_data/table/pubtabnet/train/
    label_file_list: [train_data/table/pubtabnet/PubTabNet_2.0.0_train.jsonl]
文幕地方's avatar
文幕地方 已提交
78
    transforms:
文幕地方's avatar
add ref  
文幕地方 已提交
79
      - DecodeImage:
文幕地方's avatar
文幕地方 已提交
80 81 82 83
          img_mode: BGR
          channel_first: False
      - TableMasterLabelEncode:
          learn_empty_box: False
84
          merge_no_span_structure: *merge_no_span_structure
文幕地方's avatar
文幕地方 已提交
85
          replace_empty_cell_token: True
文幕地方's avatar
文幕地方 已提交
86 87
          loc_reg_num: *loc_reg_num
          max_text_length: *max_text_length
文幕地方's avatar
文幕地方 已提交
88 89 90 91 92 93
      - ResizeTableImage:
          max_len: 480
          resize_bboxes: True
      - PaddingTableImage:
          size: [480, 480]
      - TableBoxEncode:
文幕地方's avatar
文幕地方 已提交
94 95
          in_box_format: *box_format
          out_box_format: *box_format
文幕地方's avatar
文幕地方 已提交
96 97 98 99
      - NormalizeImage:
          scale: 1./255.
          mean: [0.5, 0.5, 0.5]
          std: [0.5, 0.5, 0.5]
文幕地方's avatar
add ref  
文幕地方 已提交
100 101
          order: hwc
      - ToCHWImage: null
文幕地方's avatar
文幕地方 已提交
102
      - KeepKeys:
文幕地方's avatar
add ref  
文幕地方 已提交
103
          keep_keys: [image, structure, bboxes, bbox_masks, shape]
文幕地方's avatar
文幕地方 已提交
104 105
  loader:
    shuffle: True
文幕地方's avatar
add ref  
文幕地方 已提交
106
    batch_size_per_card: 10
文幕地方's avatar
文幕地方 已提交
107
    drop_last: True
文幕地方's avatar
add ref  
文幕地方 已提交
108
    num_workers: 8
文幕地方's avatar
文幕地方 已提交
109 110 111 112

Eval:
  dataset:
    name: PubTabDataSet
文幕地方's avatar
文幕地方 已提交
113
    data_dir: train_data/table/pubtabnet/val/
Z
zhoujun 已提交
114
    label_file_list: [train_data/table/pubtabnet/PubTabNet_2.0.0_val.jsonl]
文幕地方's avatar
文幕地方 已提交
115
    transforms:
文幕地方's avatar
add ref  
文幕地方 已提交
116
      - DecodeImage:
文幕地方's avatar
文幕地方 已提交
117 118 119 120
          img_mode: BGR
          channel_first: False
      - TableMasterLabelEncode:
          learn_empty_box: False
121
          merge_no_span_structure: *merge_no_span_structure
文幕地方's avatar
文幕地方 已提交
122
          replace_empty_cell_token: True
文幕地方's avatar
文幕地方 已提交
123 124
          loc_reg_num: *loc_reg_num
          max_text_length: *max_text_length
文幕地方's avatar
文幕地方 已提交
125 126 127 128
      - ResizeTableImage:
          max_len: 480
          resize_bboxes: True
      - PaddingTableImage:
文幕地方's avatar
add ref  
文幕地方 已提交
129
          size: [480, 480]
文幕地方's avatar
文幕地方 已提交
130
      - TableBoxEncode:
文幕地方's avatar
文幕地方 已提交
131 132
          in_box_format: *box_format
          out_box_format: *box_format
文幕地方's avatar
文幕地方 已提交
133 134
      - NormalizeImage:
          scale: 1./255.
文幕地方's avatar
add ref  
文幕地方 已提交
135 136 137 138
          mean: [0.5, 0.5, 0.5]
          std: [0.5, 0.5, 0.5]
          order: hwc
      - ToCHWImage: null
文幕地方's avatar
文幕地方 已提交
139
      - KeepKeys:
文幕地方's avatar
add ref  
文幕地方 已提交
140
          keep_keys: [image, structure, bboxes, bbox_masks, shape]
文幕地方's avatar
文幕地方 已提交
141 142 143
  loader:
    shuffle: False
    drop_last: False
文幕地方's avatar
add ref  
文幕地方 已提交
144 145
    batch_size_per_card: 10
    num_workers: 8