svtrv2_mgpstr_only_char.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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_mgpstr_only_char/
  7. eval_epoch_step: [0, 1]
  8. eval_batch_step: [0, 500]
  9. cal_metric_during_train: True
  10. pretrained_model:
  11. checkpoints:
  12. use_tensorboard: false
  13. infer_img:
  14. # for data or label process
  15. character_dict_path: &character_dict_path ./tools/utils/EN_symbol_dict.txt
  16. max_text_length: &max_text_length 25
  17. use_space_char: &use_space_char False
  18. use_amp: True
  19. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_mgpstr_only_char.txt
  20. Optimizer:
  21. name: AdamW
  22. lr: 0.00065 # 4gpus 256bs/gpu
  23. weight_decay: 0.05
  24. filter_bias_and_bn: True
  25. LRScheduler:
  26. name: OneCycleLR
  27. warmup_epoch: 1.5 # pct_start 0.075*20 = 1.5ep
  28. cycle_momentum: False
  29. Architecture:
  30. model_type: rec
  31. algorithm: MGPSTR
  32. Transform:
  33. Encoder:
  34. name: SVTRv2LNConvTwo33
  35. use_pos_embed: False
  36. out_channels: 256
  37. dims: [128, 256, 384]
  38. depths: [6, 6, 6]
  39. num_heads: [4, 8, 12]
  40. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  41. local_k: [[5, 5], [5, 5], [-1, -1]]
  42. sub_k: [[1, 1], [2, 1], [-1, -1]]
  43. last_stage: false
  44. feat2d: false
  45. Decoder:
  46. name: MGPDecoder
  47. only_char: &only_char True
  48. Loss:
  49. name: MGPLoss
  50. only_char: *only_char
  51. PostProcess:
  52. name: MPGLabelDecode
  53. character_dict_path: *character_dict_path
  54. use_space_char: *use_space_char
  55. only_char: *only_char
  56. Metric:
  57. name: RecMetric
  58. main_indicator: acc
  59. is_filter: True
  60. Train:
  61. dataset:
  62. name: RatioDataSetTVResize
  63. ds_width: True
  64. padding: false
  65. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_filter_train_challenging',
  66. '../Union14M-L-LMDB-Filtered/filter_filter_train_hard',
  67. '../Union14M-L-LMDB-Filtered/filter_filter_train_medium',
  68. '../Union14M-L-LMDB-Filtered/filter_filter_train_normal',
  69. '../Union14M-L-LMDB-Filtered/filter_filter_train_easy',
  70. ]
  71. transforms:
  72. - DecodeImagePIL: # load image
  73. img_mode: RGB
  74. - PARSeqAugPIL:
  75. - MGPLabelEncode: # Class handling label
  76. character_dict_path: *character_dict_path
  77. use_space_char: *use_space_char
  78. max_text_length: *max_text_length
  79. only_char: *only_char
  80. - KeepKeys:
  81. keep_keys: ['image', 'char_label', 'length'] # dataloader will return list in this order
  82. sampler:
  83. name: RatioSampler
  84. scales: [[128, 32]] # w, h
  85. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  86. first_bs: &bs 256
  87. fix_bs: false
  88. divided_factor: [4, 16] # w, h
  89. is_training: True
  90. loader:
  91. shuffle: True
  92. batch_size_per_card: *bs
  93. drop_last: True
  94. max_ratio: &max_ratio 4
  95. num_workers: 4
  96. Eval:
  97. dataset:
  98. name: RatioDataSetTVResize
  99. ds_width: True
  100. padding: False
  101. data_dir_list: [
  102. '../evaluation/CUTE80',
  103. '../evaluation/IC13_857',
  104. '../evaluation/IC15_1811',
  105. '../evaluation/IIIT5k',
  106. '../evaluation/SVT',
  107. '../evaluation/SVTP',
  108. ]
  109. transforms:
  110. - DecodeImagePIL: # load image
  111. img_mode: RGB
  112. - MGPLabelEncode: # Class handling label
  113. character_dict_path: *character_dict_path
  114. use_space_char: *use_space_char
  115. max_text_length: *max_text_length
  116. only_char: *only_char
  117. - KeepKeys:
  118. keep_keys: ['image', 'char_label', 'length'] # dataloader will return list in this order
  119. sampler:
  120. name: RatioSampler
  121. scales: [[128, 32]] # w, h
  122. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  123. first_bs: *bs
  124. fix_bs: false
  125. divided_factor: [4, 16] # w, h
  126. is_training: False
  127. loader:
  128. shuffle: False
  129. drop_last: False
  130. batch_size_per_card: *bs
  131. max_ratio: *max_ratio
  132. num_workers: 4