svtrv2_smtr_gtc_rctc_infer.yml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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_smtr_gtc_rctc
  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. # ./output/rec/u14m_filter/svtrv2_rctc/best.pth
  14. checkpoints:
  15. use_tensorboard: false
  16. infer_img:
  17. # for data or label process
  18. character_dict_path: &character_dict_path ./tools/utils/EN_symbol_dict.txt # 96en
  19. # ./tools/utils/ppocr_keys_v1.txt # ch
  20. max_text_length: &max_text_length 25
  21. use_space_char: &use_space_char False
  22. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_smtr_gtc_rctc.txt
  23. use_amp: 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: SVTRv2
  36. in_channels: 3
  37. Transform:
  38. Encoder:
  39. name: SVTRv2LNConvTwo33
  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. feat2d: True
  49. Decoder:
  50. name: GTCDecoder
  51. infer_gtc: False
  52. detach: False
  53. gtc_decoder:
  54. name: SMTRDecoder
  55. num_layer: 1
  56. ds: True
  57. max_len: *max_text_length
  58. next_mode: &next True
  59. sub_str_len: &subsl 5
  60. ctc_decoder:
  61. name: RCTCDecoder
  62. Loss:
  63. name: CTCLoss
  64. zero_infinity: True
  65. PostProcess:
  66. name: CTCLabelDecode
  67. character_dict_path: *character_dict_path
  68. use_space_char: *use_space_char
  69. Metric:
  70. name: RecMetric
  71. main_indicator: acc
  72. is_filter: True
  73. Train:
  74. dataset:
  75. name: RatioDataSetTVResize
  76. ds_width: True
  77. padding: false
  78. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  79. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  80. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  81. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  82. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  83. ]
  84. transforms:
  85. - DecodeImagePIL: # load image
  86. img_mode: RGB
  87. - PARSeqAugPIL:
  88. - CTCLabelEncode: # Class handling label
  89. character_dict_path: *character_dict_path
  90. use_space_char: *use_space_char
  91. max_text_length: *max_text_length
  92. - KeepKeys:
  93. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  94. sampler:
  95. name: RatioSampler
  96. scales: [[128, 32]] # w, h
  97. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  98. first_bs: &bs 128
  99. fix_bs: false
  100. divided_factor: [4, 16] # w, h
  101. is_training: True
  102. loader:
  103. shuffle: True
  104. batch_size_per_card: *bs
  105. drop_last: True
  106. max_ratio: &max_ratio 12
  107. num_workers: 4
  108. Eval:
  109. dataset:
  110. name: RatioDataSetTVResize
  111. ds_width: True
  112. padding: False
  113. data_dir_list: [
  114. '../evaluation/CUTE80',
  115. '../evaluation/IC13_857',
  116. '../evaluation/IC15_1811',
  117. '../evaluation/IIIT5k',
  118. '../evaluation/SVT',
  119. '../evaluation/SVTP',
  120. ]
  121. transforms:
  122. - DecodeImagePIL: # load image
  123. img_mode: RGB
  124. - CTCLabelEncode: # Class handling label
  125. character_dict_path: *character_dict_path
  126. use_space_char: *use_space_char
  127. max_text_length: *max_text_length
  128. - KeepKeys:
  129. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  130. sampler:
  131. name: RatioSampler
  132. scales: [[128, 32]] # w, h
  133. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  134. first_bs: *bs
  135. fix_bs: false
  136. divided_factor: [4, 16] # w, h
  137. is_training: False
  138. loader:
  139. shuffle: False
  140. drop_last: False
  141. batch_size_per_card: *bs
  142. max_ratio: *max_ratio
  143. num_workers: 4