rec_mtb_nrtr.yml 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  1. Global:
  2. use_gpu: True
  3. epoch_num: 21
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. save_model_dir: ./output/rec/nrtr/
  7. save_epoch_step: 1
  8. # evaluation is run every 2000 iterations
  9. eval_batch_step: [0, 2000]
  10. cal_metric_during_train: True
  11. pretrained_model:
  12. checkpoints:
  13. save_inference_dir:
  14. use_visualdl: False
  15. infer_img: doc/imgs_words_en/word_10.png
  16. # for data or label process
  17. character_dict_path: ppocr/utils/EN_symbol_dict.txt
  18. max_text_length: 25
  19. infer_mode: False
  20. use_space_char: False
  21. save_res_path: ./output/rec/predicts_nrtr.txt
  22. Optimizer:
  23. name: Adam
  24. beta1: 0.9
  25. beta2: 0.99
  26. clip_norm: 5.0
  27. lr:
  28. name: Cosine
  29. learning_rate: 0.0005
  30. warmup_epoch: 2
  31. regularizer:
  32. name: 'L2'
  33. factor: 0.
  34. Architecture:
  35. model_type: rec
  36. algorithm: NRTR
  37. in_channels: 1
  38. Transform:
  39. Backbone:
  40. name: MTB
  41. cnn_num: 2
  42. Head:
  43. name: Transformer
  44. d_model: 512
  45. num_encoder_layers: 6
  46. beam_size: -1 # When Beam size is greater than 0, it means to use beam search when evaluation.
  47. Loss:
  48. name: CELoss
  49. smoothing: True
  50. PostProcess:
  51. name: NRTRLabelDecode
  52. Metric:
  53. name: RecMetric
  54. main_indicator: acc
  55. Train:
  56. dataset:
  57. name: LMDBDataSet
  58. data_dir: ./train_data/data_lmdb_release/training/
  59. transforms:
  60. - DecodeImage: # load image
  61. img_mode: BGR
  62. channel_first: False
  63. - NRTRLabelEncode: # Class handling label
  64. - GrayRecResizeImg:
  65. image_shape: [100, 32] # W H
  66. resize_type: PIL # PIL or OpenCV
  67. - KeepKeys:
  68. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  69. loader:
  70. shuffle: True
  71. batch_size_per_card: 512
  72. drop_last: True
  73. num_workers: 8
  74. Eval:
  75. dataset:
  76. name: LMDBDataSet
  77. data_dir: ./train_data/data_lmdb_release/evaluation/
  78. transforms:
  79. - DecodeImage: # load image
  80. img_mode: BGR
  81. channel_first: False
  82. - NRTRLabelEncode: # Class handling label
  83. - GrayRecResizeImg:
  84. image_shape: [100, 32] # W H
  85. resize_type: PIL # PIL or OpenCV
  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: 4
  93. use_shared_memory: False