svtr_base_lpv.yml 3.1 KB

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