svtrv2_cdistnet.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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_cdistnet/
  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: &character_dict_path ./tools/utils/EN_symbol_dict.txt # 96en
  16. # ./tools/utils/ppocr_keys_v1.txt # ch
  17. max_text_length: &max_text_length 25
  18. use_space_char: &use_space_char False
  19. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_cdistnet.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.5 # pct_start 0.075*20 = 1.5ep
  29. cycle_momentum: False
  30. Architecture:
  31. model_type: rec
  32. algorithm: CDistNet
  33. in_channels: 3
  34. Transform:
  35. Encoder:
  36. name: SVTRv2LNConvTwo33
  37. use_pos_embed: False
  38. out_channels: 256
  39. dims: [128, 256, 384]
  40. depths: [6, 6, 6]
  41. num_heads: [4, 8, 12]
  42. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  43. local_k: [[5, 5], [5, 5], [-1, -1]]
  44. sub_k: [[1, 1], [2, 1], [-1, -1]]
  45. last_stage: false
  46. feat2d: True
  47. Decoder:
  48. name: CDistNetDecoder
  49. add_conv: False
  50. num_encoder_blocks: 0
  51. Loss:
  52. name: ARLoss
  53. PostProcess:
  54. name: ARLabelDecode
  55. character_dict_path: *character_dict_path
  56. use_space_char: *use_space_char
  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. - ARLabelEncode: # Class handling label
  77. character_dict_path: *character_dict_path
  78. use_space_char: *use_space_char
  79. max_text_length: *max_text_length
  80. - KeepKeys:
  81. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  82. sampler:
  83. name: RatioSampler
  84. scales: [[128, 32]] # w, h
  85. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  86. first_bs: &bs 256
  87. fix_bs: false
  88. divided_factor: [4, 16] # w, h
  89. is_training: True
  90. loader:
  91. shuffle: True
  92. batch_size_per_card: *bs
  93. drop_last: True
  94. max_ratio: &max_ratio 4
  95. num_workers: 4
  96. Eval:
  97. dataset:
  98. name: RatioDataSetTVResize
  99. ds_width: True
  100. padding: False
  101. data_dir_list: [
  102. '../evaluation/CUTE80',
  103. '../evaluation/IC13_857',
  104. '../evaluation/IC15_1811',
  105. '../evaluation/IIIT5k',
  106. '../evaluation/SVT',
  107. '../evaluation/SVTP',
  108. ]
  109. transforms:
  110. - DecodeImagePIL: # load image
  111. img_mode: RGB
  112. - ARLabelEncode: # Class handling label
  113. character_dict_path: *character_dict_path
  114. use_space_char: *use_space_char
  115. max_text_length: *max_text_length
  116. - KeepKeys:
  117. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  118. sampler:
  119. name: RatioSampler
  120. scales: [[128, 32]] # w, h
  121. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  122. first_bs: *bs
  123. fix_bs: false
  124. divided_factor: [4, 16] # w, h
  125. is_training: False
  126. loader:
  127. shuffle: False
  128. drop_last: False
  129. batch_size_per_card: *bs
  130. max_ratio: *max_ratio
  131. num_workers: 4