svtr_base_lpv_wo_glrm.yml 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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_lpv_wo_glrm/
  7. save_epoch_step: [15, 1]
  8. # evaluation is run every 2000 iterations
  9. eval_batch_step: [0, 500]
  10. eval_epoch_step: [0, 1]
  11. cal_metric_during_train: True
  12. pretrained_model:
  13. checkpoints:
  14. use_tensorboard: false
  15. infer_img:
  16. # for data or label process
  17. character_dict_path: &character_dict_path ./tools/utils/EN_symbol_dict.txt # 96en
  18. # ./tools/utils/ppocr_keys_v1.txt # ch
  19. max_text_length: &max_text_length 25
  20. use_space_char: &use_space_char False
  21. save_res_path: ./output/rec/u14m_filter/predicts_svtr_base_lpv_wo_glrm.txt
  22. use_amp: True
  23. grad_clip_val: 20
  24. Optimizer:
  25. name: Adam
  26. lr: 0.0001 # for 4gpus bs128/gpu
  27. weight_decay: 0.0
  28. filter_bias_and_bn: False
  29. betas: [0.9, 0.99]
  30. LRScheduler:
  31. name: MultiStepLR
  32. milestones: [12]
  33. gamma: 0.1
  34. Architecture:
  35. model_type: rec
  36. algorithm: LPV
  37. in_channels: 3
  38. Transform:
  39. Encoder:
  40. name: SVTRNet
  41. img_size: [32, 128]
  42. out_char_num: 25
  43. out_channels: 256
  44. patch_merging: 'Conv'
  45. embed_dim: [128, 256, 384]
  46. depth: [6, 6, 6]
  47. num_heads: [4, 8, 12]
  48. mixer: ['Conv','Conv','Conv','Conv','Conv','Conv', 'Conv','Conv', 'Global','Global','Global','Global','Global','Global','Global','Global','Global','Global']
  49. local_mixer: [[5, 5], [5, 5], [5, 5]]
  50. sub_k: [[1, 1], [1, 1]]
  51. feature2d: True
  52. last_stage: False
  53. prenorm: True
  54. Decoder:
  55. name: LPVDecoder
  56. num_layer: 3
  57. max_len: *max_text_length
  58. use_mask: False
  59. dim_feedforward: 1536
  60. nhead: 12
  61. dropout: 0.1
  62. trans_layer: 3
  63. Loss:
  64. name: LPVLoss
  65. PostProcess:
  66. name: ARLabelDecode
  67. character_dict_path: *character_dict_path
  68. use_space_char: *use_space_char
  69. Metric:
  70. name: RecMetric
  71. main_indicator: acc
  72. is_filter: True
  73. Train:
  74. dataset:
  75. name: LMDBDataSet
  76. data_dir: ../Union14M-L-LMDB-Filtered
  77. transforms:
  78. - DecodeImagePIL: # load image
  79. img_mode: RGB
  80. - PARSeqAugPIL:
  81. - ARLabelEncode: # Class handling label
  82. character_dict_path: *character_dict_path
  83. use_space_char: *use_space_char
  84. max_text_length: *max_text_length
  85. - RecTVResize:
  86. image_shape: [32, 128]
  87. padding: False
  88. - KeepKeys:
  89. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  90. loader:
  91. shuffle: True
  92. batch_size_per_card: 128
  93. drop_last: True
  94. num_workers: 4
  95. Eval:
  96. dataset:
  97. name: LMDBDataSet
  98. data_dir: ../evaluation/
  99. transforms:
  100. - DecodeImagePIL: # load image
  101. img_mode: RGB
  102. - ARLabelEncode: # Class handling label
  103. character_dict_path: *character_dict_path
  104. use_space_char: *use_space_char
  105. max_text_length: *max_text_length
  106. - RecTVResize:
  107. image_shape: [32, 128]
  108. padding: False
  109. - KeepKeys:
  110. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  111. loader:
  112. shuffle: False
  113. drop_last: False
  114. batch_size_per_card: 128
  115. num_workers: 4