svtrv2_lpv_wo_glrm.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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_lpv_wo_glrm/
  7. save_epoch_step: [15, 1]
  8. # evaluation is run every 2000 iterations
  9. eval_batch_step: [0, 500]
  10. eval_epoch_step: [0, 1]
  11. cal_metric_during_train: True
  12. pretrained_model:
  13. checkpoints:
  14. use_tensorboard: false
  15. infer_img:
  16. # for data or label process
  17. character_dict_path: &character_dict_path ./tools/utils/EN_symbol_dict.txt # 96en
  18. # ./tools/utils/ppocr_keys_v1.txt # ch
  19. max_text_length: &max_text_length 25
  20. use_space_char: &use_space_char False
  21. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_lpv_wo_glrm.txt
  22. use_amp: True
  23. grad_clip_val: 20
  24. Optimizer:
  25. name: AdamW
  26. lr: 0.000325 # for 4gpus bs128/gpu
  27. weight_decay: 0.05
  28. filter_bias_and_bn: True
  29. LRScheduler:
  30. name: OneCycleLR
  31. warmup_epoch: 1 # pct_start 0.075*20 = 1.5ep
  32. cycle_momentum: False
  33. Architecture:
  34. model_type: rec
  35. algorithm: LPV
  36. in_channels: 3
  37. Transform:
  38. Encoder:
  39. name: SVTRv2LNConvTwo33
  40. use_pos_embed: False
  41. dims: [128, 256, 384]
  42. depths: [6, 6, 6]
  43. num_heads: [4, 8, 12]
  44. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  45. local_k: [[5, 5], [5, 5], [-1, -1]]
  46. sub_k: [[1, 1], [2, 1], [-1, -1]]
  47. last_stage: false
  48. feat2d: True
  49. Decoder:
  50. name: LPVDecoder
  51. num_layer: 3
  52. max_len: *max_text_length
  53. use_mask: False
  54. dim_feedforward: 1536
  55. nhead: 12
  56. dropout: 0.1
  57. trans_layer: 3
  58. Loss:
  59. name: LPVLoss
  60. PostProcess:
  61. name: ARLabelDecode
  62. character_dict_path: *character_dict_path
  63. use_space_char: *use_space_char
  64. Metric:
  65. name: RecMetric
  66. main_indicator: acc
  67. is_filter: True
  68. Train:
  69. dataset:
  70. name: RatioDataSetTVResize
  71. ds_width: True
  72. padding: false
  73. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  74. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  75. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  76. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  77. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  78. ]
  79. transforms:
  80. - DecodeImagePIL: # load image
  81. img_mode: RGB
  82. - PARSeqAugPIL:
  83. - ARLabelEncode: # Class handling label
  84. character_dict_path: *character_dict_path
  85. use_space_char: *use_space_char
  86. max_text_length: *max_text_length
  87. - KeepKeys:
  88. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  89. sampler:
  90. name: RatioSampler
  91. scales: [[128, 32]] # w, h
  92. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  93. first_bs: &bs 128
  94. fix_bs: false
  95. divided_factor: [4, 16] # w, h
  96. is_training: True
  97. loader:
  98. shuffle: True
  99. batch_size_per_card: *bs
  100. drop_last: True
  101. max_ratio: &max_ratio 4
  102. num_workers: 4
  103. Eval:
  104. dataset:
  105. name: RatioDataSetTVResize
  106. ds_width: True
  107. padding: False
  108. data_dir_list: [
  109. '../evaluation/CUTE80',
  110. '../evaluation/IC13_857',
  111. '../evaluation/IC15_1811',
  112. '../evaluation/IIIT5k',
  113. '../evaluation/SVT',
  114. '../evaluation/SVTP',
  115. ]
  116. transforms:
  117. - DecodeImagePIL: # load image
  118. img_mode: RGB
  119. - ARLabelEncode: # Class handling label
  120. character_dict_path: *character_dict_path
  121. use_space_char: *use_space_char
  122. max_text_length: *max_text_length
  123. - KeepKeys:
  124. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  125. sampler:
  126. name: RatioSampler
  127. scales: [[128, 32]] # w, h
  128. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  129. first_bs: *bs
  130. fix_bs: false
  131. divided_factor: [4, 16] # w, h
  132. is_training: False
  133. loader:
  134. shuffle: False
  135. drop_last: False
  136. batch_size_per_card: *bs
  137. max_ratio: *max_ratio
  138. num_workers: 4