svtrv2_smtr_bi.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  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_bi
  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_bi.txt
  22. use_amp: True
  23. distributed: true
  24. Optimizer:
  25. name: AdamW
  26. lr: 0.000325
  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. infer_aug: True
  56. Loss:
  57. name: SMTRLoss
  58. PostProcess:
  59. name: SMTRLabelDecode
  60. next_mode: *next
  61. character_dict_path: *character_dict_path
  62. use_space_char: *use_space_char
  63. Metric:
  64. name: RecMetric
  65. main_indicator: acc
  66. is_filter: True
  67. Train:
  68. dataset:
  69. name: RatioDataSet
  70. ds_width: True
  71. padding: false
  72. padding_rand: true
  73. padding_doub: true
  74. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  75. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  76. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  77. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  78. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  79. ]
  80. transforms:
  81. - DecodeImage: # load image
  82. img_mode: BGR
  83. channel_first: False
  84. - PARSeqAug:
  85. - SMTRLabelEncode: # Class handling label
  86. sub_str_len: *subsl
  87. character_dict_path: *character_dict_path
  88. use_space_char: *use_space_char
  89. max_text_length: *max_text_length
  90. - KeepKeys:
  91. keep_keys: ['image', 'label', 'label_subs', 'label_next', 'length_subs',
  92. 'label_subs_pre', 'label_next_pre', 'length_subs_pre', 'length'] # dataloader will return list in this order
  93. sampler:
  94. name: RatioSampler
  95. scales: [[128, 32]] # w, h
  96. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  97. first_bs: &bs 128
  98. fix_bs: false
  99. divided_factor: [4, 16] # w, h
  100. is_training: True
  101. loader:
  102. shuffle: True
  103. batch_size_per_card: *bs
  104. drop_last: True
  105. max_ratio: &max_ratio 12
  106. num_workers: 4
  107. Eval:
  108. dataset:
  109. name: SimpleDataSet
  110. data_dir: ../ltb/
  111. label_file_list: ['../ltb/ultra_long_70_list.txt']
  112. transforms:
  113. - DecodeImage: # load image
  114. img_mode: BGR
  115. channel_first: False
  116. - ARLabelEncode: # Class handling label
  117. max_text_length: 200
  118. - SliceResize:
  119. image_shape: [3, 32, 128]
  120. padding: False
  121. max_ratio: 12
  122. - KeepKeys:
  123. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  124. loader:
  125. shuffle: False
  126. drop_last: False
  127. batch_size_per_card: 1
  128. num_workers: 2