svtrv2_busnet.yml 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  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/
  7. eval_epoch_step: [0, 1]
  8. eval_batch_step: [0, 500]
  9. cal_metric_during_train: True
  10. pretrained_model:
  11. # ./output/rec/u14m_filter/svtrv2_busnet_pretraining/best.pth
  12. checkpoints:
  13. use_tensorboard: false
  14. infer_img:
  15. # for data or label process
  16. character_dict_path: ./tools/utils/EN_symbol_dict.txt
  17. max_text_length: 25
  18. use_space_char: False
  19. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_busnet.txt
  20. use_amp: True
  21. Optimizer:
  22. name: AdamW
  23. lr: 0.00065 # 4gpus bs256/gpu
  24. weight_decay: 0.05
  25. filter_bias_and_bn: True
  26. LRScheduler:
  27. name: OneCycleLR
  28. warmup_epoch: 1 # pct_start 0.075*20 = 1.5ep
  29. cycle_momentum: False
  30. Architecture:
  31. model_type: rec
  32. algorithm: BUSBet
  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: False
  45. Decoder:
  46. name: BUSDecoder
  47. nhead: 6
  48. num_layers: 6
  49. dim_feedforward: 1536
  50. ignore_index: &ignore_index 100
  51. pretraining: False
  52. # return_id: 2
  53. Loss:
  54. name: ABINetLoss
  55. ignore_index: *ignore_index
  56. PostProcess:
  57. name: ABINetLabelDecode
  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. - ABINetLabelEncode:
  78. ignore_index: *ignore_index
  79. - KeepKeys:
  80. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  81. sampler:
  82. name: RatioSampler
  83. scales: [[128, 32]] # w, h
  84. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  85. first_bs: &bs 256
  86. fix_bs: false
  87. divided_factor: [4, 16] # w, h
  88. is_training: True
  89. loader:
  90. shuffle: True
  91. batch_size_per_card: *bs
  92. drop_last: True
  93. max_ratio: &max_ratio 4
  94. num_workers: 4
  95. Eval:
  96. dataset:
  97. name: RatioDataSetTVResize
  98. ds_width: True
  99. padding: False
  100. data_dir_list: [
  101. '../evaluation/CUTE80',
  102. '../evaluation/IC13_857',
  103. '../evaluation/IC15_1811',
  104. '../evaluation/IIIT5k',
  105. '../evaluation/SVT',
  106. '../evaluation/SVTP',
  107. ]
  108. transforms:
  109. - DecodeImagePIL: # load image
  110. img_mode: RGB
  111. - ABINetLabelEncode:
  112. ignore_index: *ignore_index
  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