svtrv2_rctc.yml 3.6 KB

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