rec_mtb_nrtr.yml 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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: SimpleDataSet
  58. data_dir: ./train_data/ic15_data/
  59. label_file_list: ["./train_data/ic15_data/rec_gt_train.txt"]
  60. transforms:
  61. - DecodeImage: # load image
  62. img_mode: BGR
  63. channel_first: False
  64. - NRTRLabelEncode: # Class handling label
  65. - GrayRecResizeImg:
  66. image_shape: [100, 32]
  67. resize_type: PIL # PIL or OpenCV
  68. - KeepKeys:
  69. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  70. loader:
  71. shuffle: True
  72. batch_size_per_card: 512
  73. drop_last: True
  74. num_workers: 8
  75. Eval:
  76. dataset:
  77. name: SimpleDataSet
  78. data_dir: ./train_data/ic15_data
  79. label_file_list: ["./train_data/ic15_data/rec_gt_test.txt"]
  80. transforms:
  81. - DecodeImage: # load image
  82. img_mode: BGR
  83. channel_first: False
  84. - NRTRLabelEncode: # Class handling label
  85. - GrayRecResizeImg:
  86. image_shape: [100, 32]
  87. resize_type: PIL # PIL or OpenCV
  88. - KeepKeys:
  89. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  90. loader:
  91. shuffle: False
  92. drop_last: False
  93. batch_size_per_card: 256
  94. num_workers: 4
  95. use_shared_memory: False