svtr_base_rctc.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/u14m_filter/svtr_base_rctc/
  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: False
  45. prenorm: True
  46. feature2d: True
  47. Decoder:
  48. name: RCTCDecoder
  49. Loss:
  50. name: CTCLoss
  51. zero_infinity: True
  52. PostProcess:
  53. name: CTCLabelDecode
  54. character_dict_path: *character_dict_path
  55. use_space_char: *use_space_char
  56. Metric:
  57. name: RecMetric
  58. main_indicator: acc
  59. is_filter: True
  60. Train:
  61. dataset:
  62. name: LMDBDataSet
  63. data_dir: ../Union14M-L-LMDB-Filtered
  64. transforms:
  65. - DecodeImagePIL: # load image
  66. img_mode: RGB
  67. - PARSeqAugPIL:
  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. - RecTVResize:
  73. image_shape: [32, 128]
  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: 4
  82. Eval:
  83. dataset:
  84. name: LMDBDataSet
  85. data_dir: ../evaluation/
  86. transforms:
  87. - DecodeImagePIL: # load image
  88. img_mode: RGB
  89. - CTCLabelEncode: # Class handling label
  90. character_dict_path: *character_dict_path
  91. use_space_char: *use_space_char
  92. max_text_length: *max_text_length
  93. - RecTVResize:
  94. image_shape: [32, 128]
  95. padding: False
  96. - KeepKeys:
  97. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  98. loader:
  99. shuffle: False
  100. drop_last: False
  101. batch_size_per_card: 256
  102. num_workers: 2