vit_parseq.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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_parseq/
  7. eval_epoch_step: [0, 1]
  8. eval_batch_step: [0, 500]
  9. cal_metric_during_train: True
  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_parseq.txt
  20. grad_clip_val: 20
  21. Optimizer:
  22. name: AdamW
  23. lr: 0.001485 # 2gpus 384bs/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: PARSeq
  33. Transform:
  34. Encoder:
  35. name: ViT
  36. Decoder:
  37. name: PARSeqDecoder
  38. decode_ar: True
  39. refine_iters: 1
  40. Loss:
  41. name: PARSeqLoss
  42. PostProcess:
  43. name: ARLabelDecode
  44. character_dict_path: *character_dict_path
  45. use_space_char: *use_space_char
  46. Metric:
  47. name: RecMetric
  48. main_indicator: acc
  49. is_filter: True
  50. Train:
  51. dataset:
  52. name: LMDBDataSet
  53. data_dir: ../Union14M-L-LMDB-Filtered
  54. transforms:
  55. - DecodeImagePIL: # load image
  56. img_mode: RGB
  57. - PARSeqAug:
  58. - ARLabelEncode: # Class handling label
  59. character_dict_path: *character_dict_path
  60. use_space_char: *use_space_char
  61. max_text_length: *max_text_length
  62. - RecTVResize:
  63. image_shape: [32, 128]
  64. padding: False
  65. - KeepKeys:
  66. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  67. loader:
  68. shuffle: True
  69. batch_size_per_card: 384
  70. drop_last: True
  71. num_workers: 4
  72. Eval:
  73. dataset:
  74. name: LMDBDataSet
  75. data_dir: ../evaluation/
  76. transforms:
  77. - DecodeImagePIL: # load image
  78. img_mode: RGB
  79. - ARLabelEncode: # Class handling label
  80. character_dict_path: *character_dict_path
  81. use_space_char: *use_space_char
  82. max_text_length: *max_text_length
  83. - RecTVResize:
  84. image_shape: [32, 128]
  85. padding: False
  86. - KeepKeys:
  87. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  88. loader:
  89. shuffle: False
  90. drop_last: False
  91. batch_size_per_card: 256
  92. num_workers: 2