rec_svtrnet.yml 2.8 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: 8.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
  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: SimpleDataSet
  73. data_dir: ./train_data/ic15_data/
  74. label_file_list: ["./train_data/ic15_data/rec_gt_train.txt"]
  75. transforms:
  76. - DecodeImage: # load image
  77. img_mode: BGR
  78. channel_first: False
  79. - CTCLabelEncode: # Class handling label
  80. - SVTRRecResizeImg:
  81. image_shape: [3, 64, 256]
  82. padding: False
  83. - KeepKeys:
  84. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  85. loader:
  86. shuffle: True
  87. batch_size_per_card: 512
  88. drop_last: True
  89. num_workers: 4
  90. Eval:
  91. dataset:
  92. name: SimpleDataSet
  93. data_dir: ./train_data/ic15_data
  94. label_file_list: ["./train_data/ic15_data/rec_gt_test.txt"]
  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