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