svtrv2_srn.yml 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  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_srn
  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: ./tools/utils/EN_symbol_dict.txt
  16. max_text_length: 25
  17. use_space_char: False
  18. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_srn.txt
  19. # find_unused_parameters: True
  20. use_amp: True
  21. grad_clip_val: 10
  22. Optimizer:
  23. name: AdamW
  24. lr: 0.000325 # for 4gpus bs128/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: SRN
  34. in_channels: 3
  35. Transform:
  36. Encoder:
  37. name: SVTRv2LNConvTwo33
  38. use_pos_embed: False
  39. out_channels: 256
  40. dims: [128, 256, 384]
  41. depths: [6, 6, 6]
  42. num_heads: [4, 8, 12]
  43. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  44. local_k: [[5, 5], [5, 5], [-1, -1]]
  45. sub_k: [[1, 1], [2, 1], [-1, -1]]
  46. last_stage: false
  47. feat2d: True
  48. Decoder:
  49. name: SRNDecoder
  50. hidden_dims: 384
  51. Loss:
  52. name: SRNLoss
  53. # smoothing: True
  54. Metric:
  55. name: RecMetric
  56. main_indicator: acc
  57. is_filter: True
  58. PostProcess:
  59. name: SRNLabelDecode
  60. Train:
  61. dataset:
  62. name: RatioDataSetTVResize
  63. ds_width: True
  64. padding: False
  65. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  66. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  67. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  68. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  69. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  70. ]
  71. transforms:
  72. - DecodeImagePIL: # load image
  73. img_mode: RGB
  74. - PARSeqAugPIL:
  75. - SRNLabelEncode: # Class handling label
  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 128
  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: ['../evaluation/CUTE80',
  98. '../evaluation/IC13_857',
  99. '../evaluation/IC15_1811',
  100. '../evaluation/IIIT5k',
  101. '../evaluation/SVT',
  102. '../evaluation/SVTP',
  103. ]
  104. transforms:
  105. - DecodeImagePIL: # load image
  106. img_mode: RGB
  107. - SRNLabelEncode: # Class handling label
  108. - KeepKeys:
  109. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  110. sampler:
  111. name: RatioSampler
  112. scales: [[128, 32]] # w, h
  113. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  114. first_bs: 256
  115. fix_bs: false
  116. divided_factor: [4, 16] # w, h
  117. is_training: False
  118. loader:
  119. shuffle: False
  120. drop_last: False
  121. batch_size_per_card: *bs
  122. max_ratio: 4
  123. num_workers: 4