ch_PP-OCRv3_rec.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. Global:
  2. debug: false
  3. use_gpu: true
  4. epoch_num: 500
  5. log_smooth_window: 20
  6. print_batch_step: 10
  7. save_model_dir: ./output/rec_ppocr_v3
  8. save_epoch_step: 3
  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/ch/word_1.jpg
  16. character_dict_path: ppocr/utils/ppocr_keys_v1.txt
  17. max_text_length: &max_text_length 25
  18. infer_mode: false
  19. use_space_char: true
  20. distributed: true
  21. save_res_path: ./output/rec/predicts_ppocrv3.txt
  22. Optimizer:
  23. name: Adam
  24. beta1: 0.9
  25. beta2: 0.999
  26. lr:
  27. name: Cosine
  28. learning_rate: 0.001
  29. warmup_epoch: 5
  30. regularizer:
  31. name: L2
  32. factor: 3.0e-05
  33. Architecture:
  34. model_type: rec
  35. algorithm: SVTR
  36. Transform:
  37. Backbone:
  38. name: MobileNetV1Enhance
  39. scale: 0.5
  40. last_conv_stride: [1, 2]
  41. last_pool_type: avg
  42. Head:
  43. name: MultiHead
  44. head_list:
  45. - CTCHead:
  46. Neck:
  47. name: svtr
  48. dims: 64
  49. depth: 2
  50. hidden_dims: 120
  51. use_guide: True
  52. Head:
  53. fc_decay: 0.00001
  54. - SARHead:
  55. enc_dim: 512
  56. max_text_length: *max_text_length
  57. Loss:
  58. name: MultiLoss
  59. loss_config_list:
  60. - CTCLoss:
  61. - SARLoss:
  62. PostProcess:
  63. name: CTCLabelDecode
  64. Metric:
  65. name: RecMetric
  66. main_indicator: acc
  67. ignore_space: False
  68. Train:
  69. dataset:
  70. name: SimpleDataSet
  71. data_dir: ./train_data/
  72. ext_op_transform_idx: 1
  73. label_file_list:
  74. - ./train_data/train_list.txt
  75. transforms:
  76. - DecodeImage:
  77. img_mode: BGR
  78. channel_first: false
  79. - RecConAug:
  80. prob: 0.5
  81. ext_data_num: 2
  82. image_shape: [48, 320, 3]
  83. max_text_length: *max_text_length
  84. - RecAug:
  85. - MultiLabelEncode:
  86. - RecResizeImg:
  87. image_shape: [3, 48, 320]
  88. - KeepKeys:
  89. keep_keys:
  90. - image
  91. - label_ctc
  92. - label_sar
  93. - length
  94. - valid_ratio
  95. loader:
  96. shuffle: true
  97. batch_size_per_card: 128
  98. drop_last: true
  99. num_workers: 4
  100. Eval:
  101. dataset:
  102. name: SimpleDataSet
  103. data_dir: ./train_data
  104. label_file_list:
  105. - ./train_data/val_list.txt
  106. transforms:
  107. - DecodeImage:
  108. img_mode: BGR
  109. channel_first: false
  110. - MultiLabelEncode:
  111. - RecResizeImg:
  112. image_shape: [3, 48, 320]
  113. - KeepKeys:
  114. keep_keys:
  115. - image
  116. - label_ctc
  117. - label_sar
  118. - length
  119. - valid_ratio
  120. loader:
  121. shuffle: false
  122. drop_last: false
  123. batch_size_per_card: 128
  124. num_workers: 4