svtrv2_ctc.yml 3.6 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_ctc/
  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_ctc.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. out_channels: 256
  39. dims: [128, 256, 384]
  40. depths: [6, 6, 6]
  41. num_heads: [4, 8, 12]
  42. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  43. local_k: [[5, 5], [5, 5], [-1, -1]]
  44. sub_k: [[1, 1], [2, 1], [-1, -1]]
  45. last_stage: True
  46. feat2d: False
  47. Decoder:
  48. name: CTCDecoder
  49. Loss:
  50. name: CTCLoss
  51. zero_infinity: True
  52. PostProcess:
  53. name: CTCLabelDecode
  54. Metric:
  55. name: RecMetric
  56. main_indicator: acc
  57. is_filter: True
  58. Train:
  59. dataset:
  60. name: RatioDataSetTVResize
  61. ds_width: True
  62. padding: False
  63. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  64. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  65. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  66. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  67. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  68. ]
  69. transforms:
  70. - DecodeImagePIL: # load image
  71. img_mode: RGB
  72. - PARSeqAugPIL:
  73. - CTCLabelEncode: # Class handling label
  74. character_dict_path: *character_dict_path
  75. use_space_char: *use_space_char
  76. max_text_length: *max_text_length
  77. - KeepKeys:
  78. keep_keys: ['image', 'label', 'length']
  79. sampler:
  80. name: RatioSampler
  81. scales: [[128, 32]] # w, h
  82. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  83. first_bs: &bs 256
  84. fix_bs: false
  85. divided_factor: [4, 16] # w, h
  86. is_training: True
  87. loader:
  88. shuffle: True
  89. batch_size_per_card: *bs
  90. drop_last: True
  91. max_ratio: 4
  92. num_workers: 4
  93. Eval:
  94. dataset:
  95. name: RatioDataSetTVResize
  96. ds_width: True
  97. padding: False
  98. data_dir_list: [
  99. '../evaluation/CUTE80',
  100. '../evaluation/IC13_857',
  101. '../evaluation/IC15_1811',
  102. '../evaluation/IIIT5k',
  103. '../evaluation/SVT',
  104. '../evaluation/SVTP',
  105. ]
  106. transforms:
  107. - DecodeImagePIL: # load image
  108. img_mode: RGB
  109. - CTCLabelEncode: # Class handling label
  110. character_dict_path: *character_dict_path
  111. use_space_char: *use_space_char
  112. max_text_length: *max_text_length
  113. - KeepKeys:
  114. keep_keys: ['image', 'label', 'length']
  115. sampler:
  116. name: RatioSampler
  117. scales: [[128, 32]] # w, h
  118. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  119. first_bs: 256
  120. fix_bs: false
  121. divided_factor: [4, 16] # w, h
  122. is_training: False
  123. loader:
  124. shuffle: False
  125. drop_last: False
  126. batch_size_per_card: *bs
  127. max_ratio: 4
  128. num_workers: 4