svtrv2_visionlan_LF_2.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112
  1. Global:
  2. device: gpu
  3. epoch_num: 10
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. output_dir: ./output/rec/u14m_filter/svtrv2_visionlan_LF2/
  7. eval_epoch_step: [0, 1]
  8. eval_batch_step: [0, 500]
  9. cal_metric_during_train: True
  10. pretrained_model:
  11. # ./output/rec/u14m_filter/svtrv2_visionlan_LF1/best.pth
  12. checkpoints:
  13. use_tensorboard: false
  14. infer_img:
  15. # for data or label process
  16. character_dict_path: &character_dict_path ./tools/utils/EN_symbol_dict.txt # 96en
  17. # ./tools/utils/ppocr_keys_v1.txt # ch
  18. max_text_length: &max_text_length 25
  19. use_space_char: &use_space_char False
  20. save_res_path: ./output/rec/u14m_filter/predicts_svtrv2_visionlan_LF2.txt
  21. grad_clip_val: 20
  22. use_amp: True
  23. Optimizer:
  24. name: AdamW
  25. lr: 0.00065 # for 4gpus bs256/gpu
  26. weight_decay: 0.05
  27. filter_bias_and_bn: True
  28. LRScheduler:
  29. name: OneCycleLR
  30. warmup_epoch: 1 # pct_start 0.075*20 = 1.5ep
  31. cycle_momentum: False
  32. Architecture:
  33. model_type: rec
  34. algorithm: VisionLAN
  35. Transform:
  36. Encoder:
  37. name: SVTRv2LNConvTwo33
  38. use_pos_embed: False
  39. dims: [128, 256, 384]
  40. depths: [6, 6, 6]
  41. num_heads: [4, 8, 12]
  42. mixer: [['Conv','Conv','Conv','Conv','Conv','Conv'],['Conv','Conv','FGlobal','Global','Global','Global'],['Global','Global','Global','Global','Global','Global']]
  43. local_k: [[5, 5], [5, 5], [-1, -1]]
  44. sub_k: [[1, 1], [2, 1], [-1, -1]]
  45. last_stage: false
  46. feat2d: True
  47. Decoder:
  48. name: VisionLANDecoder
  49. training_step: &training_step 'LF_2'
  50. n_position: 128
  51. Loss:
  52. name: VisionLANLoss
  53. training_step: *training_step
  54. PostProcess:
  55. name: VisionLANLabelDecode
  56. character_dict_path: *character_dict_path
  57. use_space_char: *use_space_char
  58. Metric:
  59. name: RecMetric
  60. main_indicator: acc
  61. is_filter: True
  62. Train:
  63. dataset:
  64. name: LMDBDataSet
  65. data_dir: ../Union14M-L-LMDB-Filtered
  66. transforms:
  67. - DecodeImagePIL: # load image
  68. img_mode: RGB
  69. - PARSeqAugPIL:
  70. - VisionLANLabelEncode:
  71. character_dict_path: *character_dict_path
  72. use_space_char: *use_space_char
  73. max_text_length: *max_text_length
  74. - RecTVResize:
  75. image_shape: [32, 128]
  76. padding: False
  77. - KeepKeys:
  78. keep_keys: ['image', 'label', 'label_res', 'label_sub', 'label_id', 'length'] # dataloader will return list in this order
  79. loader:
  80. shuffle: True
  81. batch_size_per_card: 256
  82. drop_last: True
  83. num_workers: 4
  84. Eval:
  85. dataset:
  86. name: LMDBDataSet
  87. data_dir: ../evaluation
  88. transforms:
  89. - DecodeImagePIL: # load image
  90. img_mode: RGB
  91. - VisionLANLabelEncode:
  92. character_dict_path: *character_dict_path
  93. use_space_char: *use_space_char
  94. max_text_length: *max_text_length
  95. - RecTVResize:
  96. image_shape: [32, 128]
  97. padding: False
  98. - KeepKeys:
  99. keep_keys: ['image', 'label', 'label_res', 'label_sub', 'label_id', 'length'] # dataloader will return list in this order
  100. loader:
  101. shuffle: False
  102. drop_last: False
  103. batch_size_per_card: 256
  104. num_workers: 2