vit_nrtr.yml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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/vit_nrtr_ft_mae/
  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. # ./open_ocr_vit_small_params.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_vit_nrtr_ft_mae.txt
  23. use_amp: True
  24. project_name: maerec
  25. Optimizer:
  26. name: AdamW
  27. lr: 0.00065 # for 4gpus bs256/gpu
  28. weight_decay: 0.05
  29. filter_bias_and_bn: True
  30. LRScheduler:
  31. name: OneCycleLR
  32. warmup_epoch: 1.5 # pct_start 0.075*20 : 1.5ep
  33. cycle_momentum: False
  34. Architecture:
  35. model_type: rec
  36. algorithm: BGPD
  37. in_channels: 3
  38. Transform:
  39. Encoder:
  40. name: ViT
  41. img_size: [32, 128]
  42. patch_size: [4, 4]
  43. embed_dim: 384
  44. depth: 12
  45. num_heads: 6
  46. mlp_ratio: 4
  47. qkv_bias: True
  48. use_cls_token: True
  49. Decoder:
  50. name: NRTRDecoder
  51. num_encoder_layers: -1
  52. beam_size: 0
  53. num_decoder_layers: 6
  54. nhead: 8
  55. max_len: *max_text_length
  56. Loss:
  57. name: ARLoss
  58. PostProcess:
  59. name: ARLabelDecode
  60. character_dict_path: *character_dict_path
  61. use_space_char: *use_space_char
  62. Metric:
  63. name: RecMetric
  64. main_indicator: acc
  65. is_filter: True
  66. Train:
  67. dataset:
  68. name: LMDBDataSet
  69. data_dir: ../Union14M-L-LMDB-Filtered
  70. transforms:
  71. - DecodeImagePIL: # load image
  72. img_mode: RGB
  73. - PARSeqAugPIL:
  74. - ARLabelEncode: # Class handling label
  75. character_dict_path: *character_dict_path
  76. use_space_char: *use_space_char
  77. max_text_length: *max_text_length
  78. - RecTVResize:
  79. image_shape: [32, 128]
  80. padding: False
  81. - KeepKeys:
  82. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  83. loader:
  84. shuffle: True
  85. batch_size_per_card: 256
  86. drop_last: True
  87. num_workers: 4
  88. Eval:
  89. dataset:
  90. name: LMDBDataSet
  91. data_dir: ../evaluation/
  92. transforms:
  93. - DecodeImagePIL: # load image
  94. img_mode: RGB
  95. - ARLabelEncode: # Class handling label
  96. character_dict_path: *character_dict_path
  97. use_space_char: *use_space_char
  98. max_text_length: *max_text_length
  99. - RecTVResize:
  100. image_shape: [32, 128]
  101. padding: False
  102. - KeepKeys:
  103. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  104. loader:
  105. shuffle: False
  106. drop_last: False
  107. batch_size_per_card: 256
  108. num_workers: 4