vit_large_mgpstr_only_char.yml 2.6 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/vit_base_mgpstr_only_char/
  7. eval_epoch_step: [0, 1]
  8. eval_batch_step: [0, 500]
  9. cal_metric_during_train: False
  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. use_amp: True
  19. save_res_path: ./output/rec/u14m_filter/predicts_vit_mgpstr_only_char.txt
  20. grad_clip_val: 5
  21. Optimizer:
  22. name: Adam
  23. lr: 0.000325 # 4gpus 128bs/gpu
  24. weight_decay: 0.
  25. filter_bias_and_bn: False
  26. LRScheduler:
  27. name: OneCycleLR
  28. warmup_epoch: 1.5 # pct_start 0.075*20 = 1.5ep
  29. cycle_momentum: False
  30. Architecture:
  31. model_type: rec
  32. algorithm: MGPSTR
  33. Transform:
  34. Encoder:
  35. name: ViT
  36. img_size: [32,128]
  37. patch_size: [4, 4]
  38. embed_dim: 1024
  39. depth: 24
  40. num_heads: 16
  41. mlp_ratio: 4
  42. qkv_bias: True
  43. Decoder:
  44. name: MGPDecoder
  45. only_char: &only_char True
  46. Loss:
  47. name: MGPLoss
  48. only_char: *only_char
  49. PostProcess:
  50. name: MPGLabelDecode
  51. character_dict_path: *character_dict_path
  52. use_space_char: *use_space_char
  53. only_char: *only_char
  54. Metric:
  55. name: RecMetric
  56. main_indicator: acc
  57. is_filter: True
  58. Train:
  59. dataset:
  60. name: LMDBDataSet
  61. data_dir: ../Union14M-L-LMDB-Filtered
  62. transforms:
  63. - DecodeImagePIL: # load image
  64. img_mode: RGB
  65. - PARSeqAugPIL:
  66. - MGPLabelEncode: # Class handling label
  67. character_dict_path: *character_dict_path
  68. use_space_char: *use_space_char
  69. max_text_length: *max_text_length
  70. only_char: *only_char
  71. - RecTVResize:
  72. image_shape: [32, 128]
  73. padding: False
  74. - KeepKeys:
  75. keep_keys: ['image', 'char_label', 'length'] # dataloader will return list in this order
  76. loader:
  77. shuffle: True
  78. batch_size_per_card: 128
  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. - MGPLabelEncode: # 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. only_char: *only_char
  93. - RecTVResize:
  94. image_shape: [32, 128]
  95. padding: False
  96. - KeepKeys:
  97. keep_keys: ['image', 'char_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