svrtv2_parseq.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_parseq
  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_parseq.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: PARSeq
  32. Transform:
  33. Encoder:
  34. name: SVTRv2LNConvTwo33
  35. use_pos_embed: False
  36. dims: [128, 256, 384]
  37. depths: [6, 6, 6]
  38. num_heads: [4, 8, 12]
  39. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  40. local_k: [[5, 5], [5, 5], [-1, -1]]
  41. sub_k: [[1, 1], [2, 1], [-1, -1]]
  42. last_stage: false
  43. Decoder:
  44. name: PARSeqDecoder
  45. decode_ar: True
  46. refine_iters: 1
  47. only_attn: False
  48. Loss:
  49. name: PARSeqLoss
  50. PostProcess:
  51. name: ARLabelDecode
  52. character_dict_path: *character_dict_path
  53. use_space_char: *use_space_char
  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_filter_train_challenging',
  64. '../Union14M-L-LMDB-Filtered/filter_filter_train_hard',
  65. '../Union14M-L-LMDB-Filtered/filter_filter_train_medium',
  66. '../Union14M-L-LMDB-Filtered/filter_filter_train_normal',
  67. '../Union14M-L-LMDB-Filtered/filter_filter_train_easy',
  68. ]
  69. transforms:
  70. - DecodeImagePIL: # load image
  71. img_mode: RGB
  72. - PARSeqAugPIL:
  73. - ARLabelEncode: # 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'] # dataloader will return list in this order
  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: &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. - ARLabelEncode: # 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'] # dataloader will return list in this order
  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: *bs
  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: *max_ratio
  128. num_workers: 4