svtrv2_smtr.yml 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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/svtrv2_lnconv_smtr_maxratio12
  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: ../ltb/img
  16. # for data or label process
  17. character_dict_path: &character_dict_path ./tools/utils/EN_symbol_dict.txt # 96en
  18. # ./tools/utils/ppocr_keys_v1.txt # ch
  19. max_text_length: &max_text_length 25
  20. use_space_char: &use_space_char False
  21. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_lnconv_smtr_maxratio12.txt
  22. use_amp: True
  23. distributed: true
  24. Optimizer:
  25. name: AdamW
  26. lr: 0.000325 # for 4gpus bs128/gpu
  27. weight_decay: 0.05
  28. filter_bias_and_bn: True
  29. LRScheduler:
  30. name: OneCycleLR
  31. warmup_epoch: 1.5 # pct_start 0.075*20 = 1.5ep
  32. cycle_momentum: False
  33. Architecture:
  34. model_type: rec
  35. algorithm: SMTR
  36. in_channels: 3
  37. Transform:
  38. Encoder:
  39. name: SVTRv2LNConv
  40. use_pos_embed: False
  41. dims: [128, 256, 384]
  42. depths: [6, 6, 6]
  43. num_heads: [4, 8, 12]
  44. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  45. local_k: [[5, 5], [5, 5], [-1, -1]]
  46. sub_k: [[1, 1], [2, 1], [-1, -1]]
  47. last_stage: False
  48. Decoder:
  49. name: SMTRDecoder
  50. num_layer: 1
  51. ds: True
  52. max_len: *max_text_length
  53. next_mode: &next True
  54. sub_str_len: &subsl 5
  55. Loss:
  56. name: SMTRLoss
  57. PostProcess:
  58. name: SMTRLabelDecode
  59. next_mode: *next
  60. character_dict_path: *character_dict_path
  61. use_space_char: *use_space_char
  62. Metric:
  63. name: RecMetric
  64. main_indicator: acc
  65. is_filter: True
  66. Train:
  67. dataset:
  68. name: RatioDataSet
  69. ds_width: True
  70. padding: false
  71. padding_rand: true
  72. padding_doub: true
  73. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  74. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  75. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  76. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  77. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  78. ]
  79. transforms:
  80. - DecodeImage: # load image
  81. img_mode: BGR
  82. channel_first: False
  83. - PARSeqAug:
  84. - SMTRLabelEncode: # Class handling label
  85. sub_str_len: *subsl
  86. character_dict_path: *character_dict_path
  87. use_space_char: *use_space_char
  88. max_text_length: *max_text_length
  89. - KeepKeys:
  90. keep_keys: ['image', 'label', 'label_subs', 'label_next', 'length_subs',
  91. 'label_subs_pre', 'label_next_pre', 'length_subs_pre', 'length'] # dataloader will return list in this order
  92. sampler:
  93. name: RatioSampler
  94. scales: [[128, 32]] # w, h
  95. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  96. first_bs: &bs 128
  97. fix_bs: false
  98. divided_factor: [4, 16] # w, h
  99. is_training: True
  100. loader:
  101. shuffle: True
  102. batch_size_per_card: *bs
  103. drop_last: True
  104. max_ratio: &max_ratio 12
  105. num_workers: 4
  106. Eval:
  107. dataset:
  108. name: RatioDataSet
  109. ds_width: True
  110. padding: False
  111. data_dir_list: [
  112. '../evaluation/CUTE80',
  113. '../evaluation/IC13_857',
  114. '../evaluation/IC15_1811',
  115. '../evaluation/IIIT5k',
  116. '../evaluation/SVT',
  117. '../evaluation/SVTP',
  118. ]
  119. transforms:
  120. - DecodeImage: # load image
  121. img_mode: BGR
  122. channel_first: False
  123. - ARLabelEncode: # Class handling label
  124. character_dict_path: *character_dict_path
  125. use_space_char: *use_space_char
  126. max_text_length: *max_text_length
  127. - KeepKeys:
  128. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  129. sampler:
  130. name: RatioSampler
  131. scales: [[128, 32]] # w, h
  132. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  133. first_bs: *bs
  134. fix_bs: false
  135. divided_factor: [4, 16] # w, h
  136. is_training: False
  137. loader:
  138. shuffle: False
  139. drop_last: False
  140. batch_size_per_card: *bs
  141. max_ratio: *max_ratio
  142. num_workers: 4