nrtr.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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/nrtr/
  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. checkpoints:
  14. use_tensorboard: false
  15. infer_img:
  16. # for data or label process
  17. character_dict_path: &character_dict_path ./tools/utils/EN_symbol_dict.txt # 96en
  18. # ./tools/utils/ppocr_keys_v1.txt # ch
  19. max_text_length: &max_text_length 25
  20. use_space_char: &use_space_char False
  21. save_res_path: ./output/rec/u14m_filter/predicts_nrtr.txt
  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.5 # pct_start 0.075*20 = 1.5ep
  31. cycle_momentum: False
  32. Architecture:
  33. model_type: rec
  34. algorithm: BGPD
  35. in_channels: 3
  36. Transform:
  37. Encoder:
  38. name: NRTREncoder
  39. Decoder:
  40. name: NRTRDecoder
  41. num_encoder_layers: 6
  42. beam_size: 0
  43. num_decoder_layers: 6
  44. nhead: 8
  45. max_len: *max_text_length
  46. Loss:
  47. name: ARLoss
  48. PostProcess:
  49. name: ARLabelDecode
  50. character_dict_path: *character_dict_path
  51. use_space_char: *use_space_char
  52. Metric:
  53. name: RecMetric
  54. main_indicator: acc
  55. is_filter: True
  56. Train:
  57. dataset:
  58. name: LMDBDataSet
  59. data_dir: ../Union14M-L-LMDB-Filtered
  60. transforms:
  61. - DecodeImagePIL: # load image
  62. img_mode: RGB
  63. - PARSeqAugPIL:
  64. - ARLabelEncode: # Class handling label
  65. character_dict_path: *character_dict_path
  66. use_space_char: *use_space_char
  67. max_text_length: *max_text_length
  68. - RecTVResize:
  69. image_shape: [32, 128]
  70. padding: False
  71. - KeepKeys:
  72. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  73. loader:
  74. shuffle: True
  75. batch_size_per_card: 256
  76. drop_last: True
  77. num_workers: 4
  78. Eval:
  79. dataset:
  80. name: LMDBDataSet
  81. data_dir: ../evaluation/
  82. transforms:
  83. - DecodeImagePIL: # load image
  84. img_mode: RGB
  85. - ARLabelEncode: # Class handling label
  86. character_dict_path: *character_dict_path
  87. use_space_char: *use_space_char
  88. max_text_length: *max_text_length
  89. - RecTVResize:
  90. image_shape: [32, 128]
  91. padding: False
  92. - KeepKeys:
  93. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  94. loader:
  95. shuffle: False
  96. drop_last: False
  97. batch_size_per_card: 256
  98. num_workers: 2