svtr_base_ds_igtr.yml 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. Global:
  2. device: gpu
  3. epoch_num: 20
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. output_dir: ./output/rec/u14m_filter/svtr_base_igtr
  7. save_epoch_step: [15, 1]
  8. # evaluation is run every 2000 iterations
  9. eval_batch_step: [0, 500]
  10. eval_epoch_step: [0, 1]
  11. cal_metric_during_train: True
  12. pretrained_model:
  13. checkpoints:
  14. use_tensorboard: false
  15. infer_img:
  16. # for data or label process
  17. character_dict_path: &character_dict_path
  18. # ./tools/utils/EN_symbol_dict.txt # 96en
  19. # ./tools/utils/ppocr_keys_v1.txt # ch
  20. max_text_length: &max_text_length 25
  21. use_space_char: &use_space_char False
  22. save_res_path: ./output/rec/u14m_filter/predicts_svtr_base_igtr.txt
  23. use_amp: True
  24. Optimizer:
  25. name: AdamW
  26. lr: 0.0005 # 2gpus 384bs/gpu
  27. weight_decay: 0.05
  28. filter_bias_and_bn: True
  29. LRScheduler:
  30. name: OneCycleLR
  31. warmup_epoch: 1.5
  32. cycle_momentum: False
  33. Architecture:
  34. model_type: rec
  35. algorithm: IGTR
  36. in_channels: 3
  37. Transform:
  38. Encoder:
  39. name: SVTRNet2DPos
  40. img_size: [32, -1]
  41. out_char_num: 25
  42. out_channels: 256
  43. patch_merging: 'Conv'
  44. embed_dim: [128, 256, 384]
  45. depth: [6, 6, 6]
  46. num_heads: [4, 8, 12]
  47. mixer: ['ConvB','ConvB','ConvB','ConvB','ConvB','ConvB', 'ConvB','ConvB', 'Global','Global','Global','Global','Global','Global','Global','Global','Global','Global']
  48. local_mixer: [[5, 5], [5, 5], [5, 5]]
  49. last_stage: False
  50. prenorm: True
  51. use_first_sub: False
  52. Decoder:
  53. name: IGTRDecoder
  54. dim: 384
  55. num_layer: 1
  56. ar: False
  57. refine_iter: 0
  58. # next_pred: True
  59. next_pred: False
  60. pos2d: True
  61. ds: True
  62. # pos_len: False
  63. # rec_layer: 1
  64. Loss:
  65. name: IGTRLoss
  66. PostProcess:
  67. name: IGTRLabelDecode
  68. character_dict_path: *character_dict_path
  69. use_space_char: *use_space_char
  70. Metric:
  71. name: RecMetric
  72. main_indicator: acc
  73. Train:
  74. dataset:
  75. name: RatioDataSet
  76. ds_width: True
  77. padding: &padding False
  78. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  79. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  80. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  81. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  82. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  83. ]
  84. transforms:
  85. - DecodeImage: # load image
  86. img_mode: BGR
  87. channel_first: False
  88. - PARSeqAug:
  89. - IGTRLabelEncode: # Class handling label
  90. k: 8
  91. prompt_error: False
  92. character_dict_path: *character_dict_path
  93. use_space_char: *use_space_char
  94. max_text_length: *max_text_length
  95. - KeepKeys:
  96. keep_keys: ['image', 'label', 'prompt_pos_idx_list',
  97. 'prompt_char_idx_list', 'ques_pos_idx_list', 'ques1_answer_list',
  98. 'ques2_char_idx_list', 'ques2_answer_list', 'ques3_answer', 'ques4_char_num_list',
  99. 'ques_len_list', 'ques2_len_list', 'prompt_len_list', 'length'] # dataloader will return list in this order
  100. sampler:
  101. name: RatioSampler
  102. scales: [[128, 32]] # w, h
  103. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  104. first_bs: &bs 384
  105. fix_bs: false
  106. divided_factor: [4, 16] # w, h
  107. is_training: True
  108. loader:
  109. shuffle: True
  110. batch_size_per_card: *bs
  111. drop_last: True
  112. max_ratio: &max_ratio 4
  113. num_workers: 4
  114. Eval:
  115. dataset:
  116. name: RatioDataSet
  117. ds_width: True
  118. padding: *padding
  119. data_dir_list: ['../evaluation/CUTE80',
  120. '../evaluation/IC13_857',
  121. '../evaluation/IC15_1811',
  122. '../evaluation/IIIT5k',
  123. '../evaluation/SVT',
  124. '../evaluation/SVTP']
  125. transforms:
  126. - DecodeImage: # load image
  127. img_mode: BGR
  128. channel_first: False
  129. - ARLabelEncode: # Class handling label
  130. character_dict_path: *character_dict_path
  131. use_space_char: *use_space_char
  132. max_text_length: *max_text_length
  133. - KeepKeys:
  134. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  135. sampler:
  136. name: RatioSampler
  137. scales: [[128, 32]] # w, h
  138. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  139. first_bs: 256
  140. fix_bs: false
  141. divided_factor: [4, 16] # w, h
  142. is_training: False
  143. loader:
  144. shuffle: False
  145. drop_last: False
  146. batch_size_per_card: 256
  147. max_ratio: *max_ratio
  148. num_workers: 4