svtrv2_cppd.yml 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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_cppd/
  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_cppd.txt
  22. use_amp: True
  23. Optimizer:
  24. name: AdamW
  25. lr: 0.00065 # for 4gpus bs256/gpu
  26. weight_decay: 0.05
  27. filter_bias_and_bn: True
  28. LRScheduler:
  29. name: OneCycleLR
  30. warmup_epoch: 1.5 # pct_start 0.075*20 = 1.5ep
  31. cycle_momentum: False
  32. Architecture:
  33. model_type: rec
  34. algorithm: CPPD
  35. in_channels: 3
  36. Transform:
  37. Encoder:
  38. name: SVTRv2LNConvTwo33
  39. use_pos_embed: False
  40. out_channels: 256
  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: False
  49. Decoder:
  50. name: CPPDDecoder
  51. ds: True
  52. num_layer: 2
  53. pos_len: False
  54. rec_layer: 1
  55. Loss:
  56. name: CPPDLoss
  57. ignore_index: 100
  58. smoothing: True
  59. pos_len: False
  60. sideloss_weight: 1.0
  61. PostProcess:
  62. name: CPPDLabelDecode
  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. - CPPDLabelEncode: # Class handling label
  85. pos_len: False
  86. character_dict_path: *character_dict_path
  87. use_space_char: *use_space_char
  88. max_text_length: *max_text_length
  89. - KeepKeys:
  90. keep_keys: ['image', 'label', 'label_node', 'length'] # dataloader will return list in this order
  91. sampler:
  92. name: RatioSampler
  93. scales: [[128, 32]] # w, h
  94. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  95. first_bs: &bs 256
  96. fix_bs: false
  97. divided_factor: [4, 16] # w, h
  98. is_training: True
  99. loader:
  100. shuffle: True
  101. batch_size_per_card: *bs
  102. drop_last: True
  103. max_ratio: &max_ratio 4
  104. num_workers: 4
  105. Eval:
  106. dataset:
  107. name: RatioDataSetTVResize
  108. ds_width: True
  109. padding: False
  110. data_dir_list: [
  111. '../evaluation/CUTE80',
  112. '../evaluation/IC13_857',
  113. '../evaluation/IC15_1811',
  114. '../evaluation/IIIT5k',
  115. '../evaluation/SVT',
  116. '../evaluation/SVTP',
  117. ]
  118. transforms:
  119. - DecodeImagePIL: # load image
  120. img_mode: RGB
  121. - CPPDLabelEncode: # Class handling label
  122. pos_len: False
  123. character_dict_path: *character_dict_path
  124. use_space_char: *use_space_char
  125. max_text_length: *max_text_length
  126. - KeepKeys:
  127. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  128. sampler:
  129. name: RatioSampler
  130. scales: [[128, 32]] # w, h
  131. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  132. first_bs: *bs
  133. fix_bs: false
  134. divided_factor: [4, 16] # w, h
  135. is_training: False
  136. loader:
  137. shuffle: False
  138. drop_last: False
  139. batch_size_per_card: *bs
  140. max_ratio: *max_ratio
  141. num_workers: 4