svtr_base_cppd_h8.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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/svtr_base_h8_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_svtr_base_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: SVTRNet
  39. img_size: [32, 128]
  40. out_char_num: 25
  41. out_channels: 256
  42. patch_merging: 'Conv'
  43. embed_dim: [128, 256, 384]
  44. depth: [6, 6, 6]
  45. num_heads: [4, 8, 12]
  46. sub_k: [[1, 1], [2, 1]]
  47. mixer: ['Conv','Conv','Conv','Conv','Conv','Conv', 'Conv','Conv', 'Global','Global','Global','Global','Global','Global','Global','Global','Global','Global']
  48. local_mixer: [[5, 5], [5, 5], [5, 5]]
  49. last_stage: False
  50. prenorm: True
  51. Decoder:
  52. name: CPPDDecoder
  53. vis_seq: 128
  54. num_layer: 2
  55. pos_len: False
  56. rec_layer: 1
  57. Loss:
  58. name: CPPDLoss
  59. ignore_index: 100
  60. smoothing: True
  61. pos_len: False
  62. sideloss_weight: 1.0
  63. PostProcess:
  64. name: CPPDLabelDecode
  65. character_dict_path: *character_dict_path
  66. use_space_char: *use_space_char
  67. Metric:
  68. name: RecMetric
  69. main_indicator: acc
  70. is_filter: True
  71. Train:
  72. dataset:
  73. name: LMDBDataSet
  74. data_dir: ../Union14M-L-LMDB-Filtered
  75. transforms:
  76. - DecodeImagePIL: # load image
  77. img_mode: RGB
  78. - PARSeqAugPIL:
  79. - CPPDLabelEncode: # Class handling label
  80. pos_len: False
  81. character_dict_path: *character_dict_path
  82. use_space_char: *use_space_char
  83. max_text_length: *max_text_length
  84. - RecTVResize:
  85. image_shape: [32, 128]
  86. padding: False
  87. - KeepKeys:
  88. keep_keys: ['image', 'label', 'label_node', 'length'] # dataloader will return list in this order
  89. loader:
  90. shuffle: True
  91. batch_size_per_card: 256
  92. drop_last: True
  93. num_workers: 4
  94. Eval:
  95. dataset:
  96. name: LMDBDataSet
  97. data_dir: ../evaluation/
  98. transforms:
  99. - DecodeImagePIL: # load image
  100. img_mode: RGB
  101. - CPPDLabelEncode: # Class handling label
  102. pos_len: False
  103. character_dict_path: *character_dict_path
  104. use_space_char: *use_space_char
  105. max_text_length: *max_text_length
  106. - RecTVResize:
  107. image_shape: [32, 128]
  108. padding: False
  109. - KeepKeys:
  110. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  111. loader:
  112. shuffle: False
  113. drop_last: False
  114. batch_size_per_card: 128
  115. num_workers: 4