svtrv2_robustscanner.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  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_robustscanner
  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: &max_text_length 25
  17. use_space_char: False
  18. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_robustscanner.txt
  19. use_amp: True
  20. Optimizer:
  21. name: AdamW
  22. lr: 0.00065 # for 4gpus bs256/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: robustscanner
  32. in_channels: 3
  33. Transform:
  34. Encoder:
  35. name: SVTRv2LNConvTwo33
  36. use_pos_embed: False
  37. dims: [128, 256, 384]
  38. depths: [6, 6, 6]
  39. num_heads: [4, 8, 12]
  40. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  41. local_k: [[5, 5], [5, 5], [-1, -1]]
  42. sub_k: [[1, 1], [2, 1], [-1, -1]]
  43. last_stage: false
  44. feat2d: True
  45. Decoder:
  46. name: RobustScannerDecoder
  47. enc_outchannles: 128
  48. hybrid_dec_rnn_layers: 2
  49. hybrid_dec_dropout: 0
  50. position_dec_rnn_layers: 2
  51. mask: False
  52. encode_value: False
  53. max_text_length: *max_text_length
  54. Loss:
  55. name: ARLoss
  56. PostProcess:
  57. name: ARLabelDecode
  58. Metric:
  59. name: RecMetric
  60. main_indicator: acc
  61. is_filter: True
  62. Train:
  63. dataset:
  64. name: RatioDataSetTVResize
  65. ds_width: True
  66. padding: false
  67. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  68. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  69. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  70. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  71. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  72. ]
  73. transforms:
  74. - DecodeImagePIL: # load image
  75. img_mode: RGB
  76. - PARSeqAugPIL:
  77. - ARLabelEncode: # Class handling label
  78. - KeepKeys:
  79. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  80. sampler:
  81. name: RatioSampler
  82. scales: [[128, 32]] # w, h
  83. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  84. first_bs: &bs 256
  85. fix_bs: false
  86. divided_factor: [4, 16] # w, h
  87. is_training: True
  88. loader:
  89. shuffle: True
  90. batch_size_per_card: *bs
  91. drop_last: True
  92. max_ratio: &max_ratio 4
  93. num_workers: 4
  94. Eval:
  95. dataset:
  96. name: RatioDataSetTVResize
  97. ds_width: True
  98. padding: False
  99. data_dir_list: [
  100. '../evaluation/CUTE80',
  101. '../evaluation/IC13_857',
  102. '../evaluation/IC15_1811',
  103. '../evaluation/IIIT5k',
  104. '../evaluation/SVT',
  105. '../evaluation/SVTP',
  106. ]
  107. transforms:
  108. - DecodeImagePIL: # load image
  109. img_mode: RGB
  110. - ARLabelEncode: # Class handling label
  111. - KeepKeys:
  112. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  113. sampler:
  114. name: RatioSampler
  115. scales: [[128, 32]] # w, h
  116. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  117. first_bs: *bs
  118. fix_bs: false
  119. divided_factor: [4, 16] # w, h
  120. is_training: False
  121. loader:
  122. shuffle: False
  123. drop_last: False
  124. batch_size_per_card: *bs
  125. max_ratio: *max_ratio
  126. num_workers: 4