svtr_base_cppd_ch.yml 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. Global:
  2. device: gpu
  3. epoch_num: 100
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. output_dir: ./output/rec/ch/svtr_base_cppd/
  7. save_epoch_step: [15, 1]
  8. # evaluation is run every 2000 iterations
  9. eval_batch_step: [0, 2000]
  10. eval_epoch_step: [0, 1]
  11. cal_metric_during_train: False
  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/ppocr_keys_v1.txt
  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/ch/predicts_svtr_base_cppd.txt
  23. use_amp: True
  24. Optimizer:
  25. name: AdamW
  26. lr: 0.0005 # for 4gpus bs128/gpu
  27. weight_decay: 0.05
  28. filter_bias_and_bn: True
  29. LRScheduler:
  30. name: CosineAnnealingLR
  31. warmup_epoch: 5
  32. Architecture:
  33. model_type: rec
  34. algorithm: CPPD
  35. in_channels: 3
  36. Transform:
  37. Encoder:
  38. name: SVTRNet
  39. img_size: [32, 256]
  40. patch_merging: 'Conv'
  41. embed_dim: [128, 256, 384]
  42. depth: [6, 6, 4]
  43. num_heads: [4, 8, 12]
  44. mixer: ['Conv','Conv','Conv','Conv','Conv','Conv', 'Conv','Conv', 'Global','Global','Global','Global','Global','Global','Global','Global','Global','Global']
  45. local_mixer: [[5, 5], [5, 5], [5, 5]]
  46. last_stage: False
  47. prenorm: True
  48. Decoder:
  49. name: CPPDDecoder
  50. vis_seq: 128
  51. num_layer: 3
  52. pos_len: False
  53. rec_layer: 1
  54. ch: True
  55. Loss:
  56. name: CPPDLoss
  57. ignore_index: 7000
  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. Train:
  69. dataset:
  70. name: LMDBDataSet
  71. data_dir: ../benchmark_bctr/benchmark_bctr_train
  72. transforms:
  73. - DecodeImage: # load image
  74. img_mode: BGR
  75. channel_first: False
  76. - CPPDLabelEncode: # Class handling label
  77. pos_len: False
  78. ch: True
  79. ignore_index: 7000
  80. character_dict_path: *character_dict_path
  81. use_space_char: *use_space_char
  82. max_text_length: *max_text_length
  83. - SVTRResize:
  84. image_shape: [3, 32, 256]
  85. padding: True
  86. - KeepKeys:
  87. keep_keys: ['image', 'label', 'label_node', 'label_index', 'length'] # dataloader will return list in this order
  88. loader:
  89. shuffle: True
  90. batch_size_per_card: 128
  91. drop_last: True
  92. num_workers: 8
  93. Eval:
  94. dataset:
  95. name: LMDBDataSet
  96. data_dir: ../benchmark_bctr/benchmark_bctr_test/scene_test
  97. transforms:
  98. - DecodeImage: # load image
  99. img_mode: BGR
  100. channel_first: False
  101. - CPPDLabelEncode: # Class handling label
  102. pos_len: False
  103. ch: True
  104. ignore_index: 7000
  105. character_dict_path: *character_dict_path
  106. use_space_char: *use_space_char
  107. max_text_length: *max_text_length
  108. - SVTRResize:
  109. image_shape: [3, 32, 256]
  110. padding: True
  111. - KeepKeys:
  112. keep_keys: ['image', 'label', 'label_node', 'length'] # dataloader will return list in this order
  113. loader:
  114. shuffle: False
  115. drop_last: False
  116. batch_size_per_card: 256
  117. num_workers: 4