svtrnet_ctc_syn.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. Global:
  2. device: gpu
  3. epoch_num: 20
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. output_dir: ./output/rec/syn/svtr_tiny/
  7. eval_epoch_step: [0, 1]
  8. eval_batch_step: [0, 500]
  9. cal_metric_during_train: True
  10. pretrained_model:
  11. checkpoints:
  12. use_tensorboard: false
  13. infer_img:
  14. # for data or label process
  15. character_dict_path: &character_dict_path ./tools/utils/EN_symbol_dict.txt # 96en
  16. # ./tools/utils/ppocr_keys_v1.txt # ch
  17. max_text_length: &max_text_length 25
  18. use_space_char: &use_space_char False
  19. save_res_path: ./output/rec/syn/predicts_svtr_tiny.txt
  20. use_amp: True
  21. Optimizer:
  22. name: AdamW
  23. lr: 0.0005 # for 4gpus bs256/gpu
  24. weight_decay: 0.05
  25. filter_bias_and_bn: True
  26. LRScheduler:
  27. name: CosineAnnealingLR
  28. warmup_epoch: 2
  29. Architecture:
  30. model_type: rec
  31. algorithm: SVTR
  32. Transform:
  33. Encoder:
  34. name: SVTRNet
  35. img_size: [32, 100]
  36. out_char_num: 25 # W//4 or W//8 or W/12
  37. out_channels: 192
  38. patch_merging: 'Conv'
  39. embed_dim: [64, 128, 256]
  40. depth: [3, 6, 3]
  41. num_heads: [2, 4, 8]
  42. mixer: ['Local','Local','Local','Local','Local','Local','Global','Global','Global','Global','Global','Global']
  43. local_mixer: [[7, 11], [7, 11], [7, 11]]
  44. last_stage: True
  45. prenorm: False
  46. Decoder:
  47. name: CTCDecoder
  48. Loss:
  49. name: CTCLoss
  50. zero_infinity: True
  51. PostProcess:
  52. name: CTCLabelDecode
  53. character_dict_path: *character_dict_path
  54. use_space_char: *use_space_char
  55. Metric:
  56. name: RecMetric
  57. main_indicator: acc
  58. Train:
  59. dataset:
  60. name: STRLMDBDataSet
  61. data_dir: ./
  62. transforms:
  63. - DecodeImage: # load image
  64. img_mode: BGR
  65. channel_first: False
  66. # - SVTRRecAug:
  67. # aug_type: 0 # or 1
  68. - CTCLabelEncode: # Class handling label
  69. character_dict_path: *character_dict_path
  70. use_space_char: *use_space_char
  71. max_text_length: *max_text_length
  72. - SVTRResize:
  73. image_shape: [3, 32, 100]
  74. padding: False
  75. - KeepKeys:
  76. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  77. loader:
  78. shuffle: True
  79. batch_size_per_card: 256
  80. drop_last: True
  81. num_workers: 8
  82. Eval:
  83. dataset:
  84. name: LMDBDataSet
  85. data_dir: ../evaluation/
  86. transforms:
  87. - DecodeImage: # load image
  88. img_mode: BGR
  89. channel_first: False
  90. - CTCLabelEncode: # Class handling label
  91. character_dict_path: *character_dict_path
  92. use_space_char: *use_space_char
  93. max_text_length: *max_text_length
  94. - SVTRResize:
  95. image_shape: [3, 32, 100]
  96. padding: False
  97. - KeepKeys:
  98. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  99. loader:
  100. shuffle: False
  101. drop_last: False
  102. batch_size_per_card: 256
  103. num_workers: 2