svtrv2_lpv.yml 4.0 KB

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