svtr_base_ctc.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. Global:
  2. device: gpu
  3. epoch_num: 20
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. output_dir: ./output/rec/u14m_filter/svtr_base_ctc/
  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
  16. max_text_length: &max_text_length 25
  17. use_space_char: &use_space_char False
  18. save_res_path: ./output/rec/u14m_filter/predicts_svtr_tiny.txt
  19. use_amp: True
  20. Optimizer:
  21. name: AdamW
  22. lr: 0.00065 # for 4gpus bs256/gpu
  23. weight_decay: 0.05
  24. filter_bias_and_bn: True
  25. LRScheduler:
  26. name: OneCycleLR
  27. warmup_epoch: 1.5 # pct_start 0.075*20 = 1.5ep
  28. cycle_momentum: False
  29. Architecture:
  30. model_type: rec
  31. algorithm: SVTR
  32. Transform:
  33. Encoder:
  34. name: SVTRNet
  35. img_size: [32, 128]
  36. out_char_num: 32
  37. out_channels: 256
  38. patch_merging: 'Conv'
  39. embed_dim: [128, 256, 384]
  40. depth: [6, 6, 6]
  41. num_heads: [4, 8, 12]
  42. mixer: ['Conv','Conv','Conv','Conv','Conv','Conv', 'Conv','Conv', 'Global','Global','Global','Global','Global','Global','Global','Global','Global','Global']
  43. local_mixer: [[5, 5], [5, 5], [5, 5]]
  44. last_stage: True
  45. prenorm: True
  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. is_filter: True
  59. Train:
  60. dataset:
  61. name: LMDBDataSet
  62. data_dir: ../Union14M-L-LMDB-Filtered
  63. transforms:
  64. - DecodeImagePIL: # load image
  65. img_mode: RGB
  66. - PARSeqAugPIL:
  67. - CTCLabelEncode: # Class handling label
  68. character_dict_path: *character_dict_path
  69. use_space_char: *use_space_char
  70. max_text_length: *max_text_length
  71. - RecTVResize:
  72. image_shape: [32, 128]
  73. padding: False
  74. - KeepKeys:
  75. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  76. loader:
  77. shuffle: True
  78. batch_size_per_card: 256
  79. drop_last: True
  80. num_workers: 4
  81. Eval:
  82. dataset:
  83. name: LMDBDataSet
  84. data_dir: ../evaluation/
  85. transforms:
  86. - DecodeImagePIL: # load image
  87. img_mode: RGB
  88. - CTCLabelEncode: # Class handling label
  89. character_dict_path: *character_dict_path
  90. use_space_char: *use_space_char
  91. max_text_length: *max_text_length
  92. - RecTVResize:
  93. image_shape: [32, 128]
  94. padding: False
  95. - KeepKeys:
  96. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  97. loader:
  98. shuffle: False
  99. drop_last: False
  100. batch_size_per_card: 256
  101. num_workers: 2