svtrv2_busnet_pretraining.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134
  1. Global:
  2. device: gpu
  3. epoch_num: 10
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. output_dir: ./output/rec/u14m_filter/svtrv2_busnet_pretraining/
  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_busnet_pretraining.txt
  19. use_amp: True
  20. Optimizer:
  21. name: AdamW
  22. lr: 0.00065 # 4gpus bs256/gpu
  23. weight_decay: 0.05
  24. filter_bias_and_bn: True
  25. LRScheduler:
  26. name: OneCycleLR
  27. warmup_epoch: 1 # pct_start 0.075*20 = 1.5ep
  28. cycle_momentum: False
  29. Architecture:
  30. model_type: rec
  31. algorithm: BUSBet
  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. feat2d: False
  44. Decoder:
  45. name: BUSDecoder
  46. nhead: 6
  47. num_layers: 6
  48. dim_feedforward: 1536
  49. ignore_index: &ignore_index 100
  50. pretraining: True
  51. # return_id: 0
  52. Loss:
  53. name: ABINetLoss
  54. ignore_index: *ignore_index
  55. PostProcess:
  56. name: ABINetLabelDecode
  57. Metric:
  58. name: RecMetric
  59. main_indicator: acc
  60. is_filter: True
  61. Train:
  62. dataset:
  63. name: RatioDataSetTVResize
  64. ds_width: True
  65. padding: false
  66. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  67. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  68. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  69. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  70. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  71. ]
  72. transforms:
  73. - DecodeImagePIL: # load image
  74. img_mode: RGB
  75. - PARSeqAugPIL:
  76. - ABINetLabelEncode:
  77. ignore_index: *ignore_index
  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. - ABINetLabelEncode:
  111. ignore_index: *ignore_index
  112. - KeepKeys:
  113. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  114. sampler:
  115. name: RatioSampler
  116. scales: [[128, 32]] # w, h
  117. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  118. first_bs: *bs
  119. fix_bs: false
  120. divided_factor: [4, 16] # w, h
  121. is_training: False
  122. loader:
  123. shuffle: False
  124. drop_last: False
  125. batch_size_per_card: *bs
  126. max_ratio: *max_ratio
  127. num_workers: 4