svtr_base_cppd.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_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
  18. # ./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_svtr_base_cppd.txt
  23. use_amp: True
  24. Optimizer:
  25. name: AdamW
  26. lr: 0.00065 # for 4gpus bs256/gpu
  27. weight_decay: 0.05
  28. filter_bias_and_bn: True
  29. LRScheduler:
  30. name: OneCycleLR
  31. warmup_epoch: 1.5 # pct_start 0.075*20 = 1.5ep
  32. cycle_momentum: False
  33. Architecture:
  34. model_type: rec
  35. algorithm: CPPD
  36. in_channels: 3
  37. Transform:
  38. Encoder:
  39. name: SVTRNet
  40. img_size: [32, 128]
  41. out_char_num: 25
  42. out_channels: 256
  43. patch_merging: 'Conv'
  44. embed_dim: [128, 256, 384]
  45. depth: [6, 6, 6]
  46. num_heads: [4, 8, 12]
  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: 64
  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. Train:
  71. dataset:
  72. name: LMDBDataSet
  73. data_dir: ../Union14M-L-LMDB-Filtered
  74. transforms:
  75. - DecodeImagePIL: # load image
  76. img_mode: RGB
  77. - PARSeqAugPIL:
  78. - CPPDLabelEncode: # Class handling label
  79. pos_len: False
  80. character_dict_path: *character_dict_path
  81. use_space_char: *use_space_char
  82. max_text_length: *max_text_length
  83. - RecTVResize:
  84. image_shape: [32, 128]
  85. padding: False
  86. - KeepKeys:
  87. keep_keys: ['image', 'label', 'label_node', 'length'] # dataloader will return list in this order
  88. loader:
  89. shuffle: True
  90. batch_size_per_card: 256
  91. drop_last: True
  92. num_workers: 4
  93. Eval:
  94. dataset:
  95. name: LMDBDataSet
  96. data_dir: ../evaluation/
  97. transforms:
  98. - DecodeImagePIL: # load image
  99. img_mode: RGB
  100. - CPPDLabelEncode: # Class handling label
  101. pos_len: False
  102. character_dict_path: *character_dict_path
  103. use_space_char: *use_space_char
  104. max_text_length: *max_text_length
  105. - RecTVResize:
  106. image_shape: [32, 128]
  107. padding: False
  108. - KeepKeys:
  109. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  110. loader:
  111. shuffle: False
  112. drop_last: False
  113. batch_size_per_card: 128
  114. num_workers: 4