rec_svtrnet.yml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. Global:
  2. use_gpu: True
  3. epoch_num: 20
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. save_model_dir: ./output/rec/svtr/
  7. save_epoch_step: 1
  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:
  18. character_type: en
  19. max_text_length: 25
  20. infer_mode: False
  21. use_space_char: False
  22. save_res_path: ./output/rec/predicts_svtr_tiny.txt
  23. Optimizer:
  24. name: AdamW
  25. beta1: 0.9
  26. beta2: 0.99
  27. epsilon: 1.e-8
  28. weight_decay: 0.05
  29. no_weight_decay_name: norm pos_embed
  30. one_dim_param_no_weight_decay: True
  31. lr:
  32. name: Cosine
  33. learning_rate: 0.0005
  34. warmup_epoch: 2
  35. Architecture:
  36. model_type: rec
  37. algorithm: SVTR
  38. Transform:
  39. name: STN_ON
  40. tps_inputsize: [32, 64]
  41. tps_outputsize: [32, 100]
  42. num_control_points: 20
  43. tps_margins: [0.05,0.05]
  44. stn_activation: none
  45. Backbone:
  46. name: SVTRNet
  47. img_size: [32, 100]
  48. out_char_num: 25 # W//4 or W//8 or W/12
  49. out_channels: 192
  50. patch_merging: 'Conv'
  51. embed_dim: [64, 128, 256]
  52. depth: [3, 6, 3]
  53. num_heads: [2, 4, 8]
  54. mixer: ['Local','Local','Local','Local','Local','Local','Global','Global','Global','Global','Global','Global']
  55. local_mixer: [[7, 11], [7, 11], [7, 11]]
  56. last_stage: True
  57. prenorm: False
  58. Neck:
  59. name: SequenceEncoder
  60. encoder_type: reshape
  61. Head:
  62. name: CTCHead
  63. Loss:
  64. name: CTCLoss
  65. PostProcess:
  66. name: CTCLabelDecode
  67. Metric:
  68. name: RecMetric
  69. main_indicator: acc
  70. Train:
  71. dataset:
  72. name: LMDBDataSet
  73. data_dir: ./train_data/data_lmdb_release/training/
  74. transforms:
  75. - DecodeImage: # load image
  76. img_mode: BGR
  77. channel_first: False
  78. - SVTRRecAug:
  79. aug_type: 0 # or 1
  80. - CTCLabelEncode: # Class handling label
  81. - SVTRRecResizeImg:
  82. image_shape: [3, 64, 256]
  83. padding: False
  84. - KeepKeys:
  85. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  86. loader:
  87. shuffle: True
  88. batch_size_per_card: 512
  89. drop_last: True
  90. num_workers: 8
  91. Eval:
  92. dataset:
  93. name: LMDBDataSet
  94. data_dir: ./train_data/data_lmdb_release/evaluation/
  95. transforms:
  96. - DecodeImage: # load image
  97. img_mode: BGR
  98. channel_first: False
  99. - CTCLabelEncode: # Class handling label
  100. - SVTRRecResizeImg:
  101. image_shape: [3, 64, 256]
  102. padding: False
  103. - KeepKeys:
  104. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  105. loader:
  106. shuffle: False
  107. drop_last: False
  108. batch_size_per_card: 256
  109. num_workers: 2