layoutxlm_funsd.yml 3.4 KB
Newer Older
1 2
Global:
  use_gpu: True
文幕地方's avatar
文幕地方 已提交
3
  epoch_num: &epoch_num 200
4 5
  log_smooth_window: 10
  print_batch_step: 10
6
  save_model_dir: ./output/re_layoutxlm_funsd
7 8
  save_epoch_step: 2000
  # evaluation is run every 10 iterations after the 0th iteration
9
  eval_batch_step: [ 0, 57 ]
10 11 12
  cal_metric_during_train: False
  save_inference_dir:
  use_visualdl: False
文幕地方's avatar
文幕地方 已提交
13
  seed: 2022
14 15
  infer_img: train_data/FUNSD/testing_data/images/83624198.png
  save_res_path: ./output/re_layoutxlm_funsd/res/
16 17 18 19 20 21 22

Architecture:
  model_type: vqa
  algorithm: &algorithm "LayoutXLM"
  Transform:
  Backbone:
    name: LayoutXLMForRe
文幕地方's avatar
文幕地方 已提交
23
    pretrained: True
文幕地方's avatar
文幕地方 已提交
24
    checkpoints:
25 26 27 28 29 30 31 32 33 34 35 36

Loss:
  name: LossFromOutput
  key: loss
  reduction: mean

Optimizer:
  name: AdamW
  beta1: 0.9
  beta2: 0.999
  clip_norm: 10
  lr:
文幕地方's avatar
文幕地方 已提交
37 38
    learning_rate: 0.00005
    warmup_epoch: 10
39
  regularizer:
文幕地方's avatar
文幕地方 已提交
40
    name: L2
41 42 43 44 45 46 47 48 49 50 51 52
    factor: 0.00000
    
PostProcess:
  name: VQAReTokenLayoutLMPostProcess

Metric:
  name: VQAReTokenMetric
  main_indicator: hmean

Train:
  dataset:
    name: SimpleDataSet
53
    data_dir: ./train_data/FUNSD/training_data/images/
54
    label_file_list: 
55 56
      - ./train_data/FUNSD/train_v4.json
      # - ./train_data/FUNSD/train.json
57 58 59 60 61 62 63 64
    ratio_list: [ 1.0 ]
    transforms:
      - DecodeImage: # load image
          img_mode: RGB
          channel_first: False
      - VQATokenLabelEncode: # Class handling label
          contains_re: True
          algorithm: *algorithm
65 66
          class_path: &class_path ./train_data/FUNSD/class_list.txt
          use_textline_bbox_info: &use_textline_bbox_info True
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81
      - VQATokenPad:
          max_seq_len: &max_seq_len 512
          return_attention_mask: True
      - VQAReTokenRelation:
      - VQAReTokenChunk:
          max_seq_len: *max_seq_len
      - Resize:
          size: [224,224]
      - NormalizeImage:
          scale: 1
          mean: [ 123.675, 116.28, 103.53 ]
          std: [ 58.395, 57.12, 57.375 ]
          order: 'hwc'
      - ToCHWImage:
      - KeepKeys:
82 83
          # dataloader will return list in this order
          keep_keys: [ 'input_ids', 'bbox', 'attention_mask', 'token_type_ids', 'image', 'entities', 'relations']
84
  loader:
85
    shuffle: False
86 87
    drop_last: False
    batch_size_per_card: 8
88
    num_workers: 16
89 90 91 92 93
    collate_fn: ListCollator

Eval:
  dataset:
    name: SimpleDataSet
94 95 96 97
    data_dir: ./train_data/FUNSD/testing_data/images/
    label_file_list: 
      - ./train_data/FUNSD/test_v4.json
      # - ./train_data/FUNSD/test.json
98 99 100 101 102 103 104 105
    transforms:
      - DecodeImage: # load image
          img_mode: RGB
          channel_first: False
      - VQATokenLabelEncode: # Class handling label
          contains_re: True
          algorithm: *algorithm
          class_path: *class_path
106
          use_textline_bbox_info: *use_textline_bbox_info
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121
      - VQATokenPad:
          max_seq_len: *max_seq_len
          return_attention_mask: True
      - VQAReTokenRelation:
      - VQAReTokenChunk:
          max_seq_len: *max_seq_len
      - Resize:
          size: [224,224]
      - NormalizeImage:
          scale: 1
          mean: [ 123.675, 116.28, 103.53 ]
          std: [ 58.395, 57.12, 57.375 ]
          order: 'hwc'
      - ToCHWImage:
      - KeepKeys:
122 123
          # dataloader will return list in this order
          keep_keys: [ 'input_ids', 'bbox', 'attention_mask', 'token_type_ids', 'image', 'entities', 'relations']
124 125 126 127
  loader:
    shuffle: False
    drop_last: False
    batch_size_per_card: 8
文幕地方's avatar
文幕地方 已提交
128
    num_workers: 8
129
    collate_fn: ListCollator