rec_d28_can.yml 2.9 KB
Newer Older
D
dorren 已提交
1 2 3 4 5 6 7
Global:
  use_gpu: True
  epoch_num: 240
  log_smooth_window: 20
  print_batch_step: 10
  save_model_dir: ./output/rec/can/
  save_epoch_step: 1
8
  # evaluation is run every 1105 iterations (1 epoch)(batch_size = 8)
D
dorren 已提交
9 10
  eval_batch_step: [0, 1105]
  cal_metric_during_train: True
11 12 13
  pretrained_model:
  checkpoints:
  save_inference_dir:
D
dorren 已提交
14
  use_visualdl: False
15
  infer_img: doc/datasets/crohme_demo/hme_00.jpg
D
dorren 已提交
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
  # for data or label process
  character_dict_path: ppocr/utils/dict/latex_symbol_dict.txt
  max_text_length: 36
  infer_mode: False
  use_space_char: False
  save_res_path: ./output/rec/predicts_can.txt

Optimizer:
  name: Momentum
  momentum: 0.9
  clip_norm_global: 100.0
  lr:
    name: TwoStepCosine
    learning_rate: 0.01
    warmup_epoch: 1
  weight_decay: 0.0001

Architecture:
  model_type: rec
  algorithm: CAN
  in_channels: 1
  Transform:
  Backbone:
    name: DenseNet 
    growthRate: 24
    reduction: 0.5
    bottleneck: True
    use_dropout: True
    input_channel: 1 
  Head:
    name: CANHead
    in_channel: 684
    out_channel: 111
    max_text_length: 36
    ratio: 16
    attdecoder:
      is_train: True
      input_size: 256
      hidden_size: 256
      encoder_out_channel: 684
      dropout: True
      dropout_ratio: 0.5
      word_num: 111
      counting_decoder_out_channel: 111
      attention:
        attention_dim: 512
        word_conv_kernel: 1
   
Loss:
  name: CANLoss

PostProcess:
68 69
  name: CANLabelDecode
  character_dict_path: ppocr/utils/dict/latex_symbol_dict.txt
D
dorren 已提交
70 71 72 73 74 75 76

Metric:
  name: CANMetric
  main_indicator: exp_rate

Train:
  dataset:
77
    name: SimpleDataSet
D
dorren 已提交
78
    data_dir: ./train_data/CROHME_lite/training/images/
D
dorren 已提交
79 80 81
    transforms:
      - DecodeImage:
          channel_first: False
82 83 84 85
      - NormalizeImage:
          mean: [0,0,0]
          std: [1,1,1]
          order: 'hwc'
D
dorren 已提交
86 87
      - GrayImageChannelFormat: 
          inverse: True
88
      - CANLabelEncode:
89 90
          character_dict_path: ppocr/utils/dict/latex_symbol_dict.txt
          lower: False
D
dorren 已提交
91 92
      - KeepKeys:
          keep_keys: ['image', 'label']
D
dorren 已提交
93
    label_file_list: ["./train_data/CROHME_lite/training/labels.txt"]
D
dorren 已提交
94 95
  loader:
    shuffle: True
96 97 98
    batch_size_per_card: 8
    drop_last: False
    num_workers: 4
D
dorren 已提交
99 100 101 102
    collate_fn: DyMaskCollator

Eval:
  dataset:
103
    name: SimpleDataSet
D
dorren 已提交
104
    data_dir: ./train_data/CROHME_lite/evaluation/images/
D
dorren 已提交
105 106 107
    transforms: 
      - DecodeImage:
          channel_first: False
108 109 110 111
      - NormalizeImage:
          mean: [0,0,0]
          std: [1,1,1]
          order: 'hwc'
D
dorren 已提交
112 113
      - GrayImageChannelFormat:
          inverse: True
114
      - CANLabelEncode:
115 116
          character_dict_path: ppocr/utils/dict/latex_symbol_dict.txt
          lower: False
D
dorren 已提交
117 118
      - KeepKeys:
          keep_keys: ['image', 'label']
D
dorren 已提交
119
    label_file_list: ["./train_data/CROHME_lite/evaluation/labels.txt"]
D
dorren 已提交
120 121 122 123 124 125
  loader:
    shuffle: False
    drop_last: False
    batch_size_per_card: 1
    num_workers: 4
    collate_fn: DyMaskCollator