rec_svtrnet_cppd_base_ch.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. Global:
  2. use_gpu: True
  3. epoch_num: 100
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. save_model_dir: ./output/rec/svtr_cppd_base_ch/
  7. save_epoch_step: 10
  8. # evaluation is run every 2000 iterations after the 0th iteration
  9. eval_batch_step: [0, 2000]
  10. cal_metric_during_train: True
  11. pretrained_model:
  12. checkpoints:
  13. save_inference_dir:
  14. use_visualdl: False
  15. infer_img: doc/imgs_words_en/word_10.png
  16. # for data or label process
  17. character_dict_path: ppocr/utils/ppocr_keys_v1.txt
  18. max_text_length: 25
  19. infer_mode: False
  20. use_space_char: False
  21. save_res_path: ./output/rec/predicts_svtr_cppd_base_ch.txt
  22. Optimizer:
  23. name: AdamW
  24. beta1: 0.9
  25. beta2: 0.99
  26. epsilon: 1.e-8
  27. weight_decay: 0.05
  28. no_weight_decay_name: norm pos_embed char_node_embed pos_node_embed char_pos_embed vis_pos_embed
  29. one_dim_param_no_weight_decay: True
  30. lr:
  31. name: Cosine
  32. learning_rate: 0.0005 # 4gpus 128bs
  33. warmup_epoch: 5
  34. Architecture:
  35. model_type: rec
  36. algorithm: CPPD
  37. Transform:
  38. Backbone:
  39. name: SVTRNet
  40. img_size: [32, 256]
  41. patch_merging: 'Conv'
  42. embed_dim: [128, 256, 384]
  43. depth: [6, 6, 4]
  44. num_heads: [4, 8, 12]
  45. mixer: ['Conv','Conv','Conv','Conv','Conv','Conv', 'Conv','Conv', 'Global','Global','Global','Global','Global','Global','Global','Global','Global','Global']
  46. local_mixer: [[5, 5], [5, 5], [5, 5]]
  47. last_stage: False
  48. prenorm: True
  49. Head:
  50. name: CPPDHead
  51. dim: 384
  52. vis_seq: 128
  53. ch: &ch True
  54. Loss:
  55. name: CPPDLoss
  56. ignore_index: &ignore_index 7000 # must be greater than the number of character classes
  57. smoothing: True
  58. sideloss_weight: 1.0
  59. PostProcess:
  60. name: CPPDLabelDecode
  61. Metric:
  62. name: RecMetric
  63. main_indicator: acc
  64. Train:
  65. dataset:
  66. name: LMDBDataSet
  67. data_dir: ./train_data/data_lmdb_release/training/
  68. transforms:
  69. - DecodeImage: # load image
  70. img_mode: BGR
  71. channel_first: False
  72. - CPPDLabelEncode: # Class handling label
  73. ignore_index: *ignore_index
  74. ch: *ch
  75. - SVTRRecResizeImg:
  76. image_shape: [3, 32, 256]
  77. padding: True
  78. - KeepKeys:
  79. keep_keys: ['image', 'label', 'label_node', 'label_index', 'length'] # dataloader will return list in this order
  80. loader:
  81. shuffle: True
  82. batch_size_per_card: 256
  83. drop_last: True
  84. num_workers: 8
  85. Eval:
  86. dataset:
  87. name: LMDBDataSet
  88. data_dir: ./train_data/data_lmdb_release/evaluation/
  89. transforms:
  90. - DecodeImage: # load image
  91. img_mode: BGR
  92. channel_first: False
  93. - CPPDLabelEncode: # Class handling label
  94. ignore_index: *ignore_index
  95. ch: *ch
  96. - SVTRRecResizeImg:
  97. image_shape: [3, 32, 256]
  98. padding: True
  99. - KeepKeys:
  100. keep_keys: ['image', 'label', 'label_node','label_index','length'] # dataloader will return list in this order
  101. loader:
  102. shuffle: False
  103. drop_last: False
  104. batch_size_per_card: 256
  105. num_workers: 2