svtr_base_nrtr_syn.yml 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. Global:
  2. device: gpu
  3. epoch_num: 60
  4. log_smooth_window: 20
  5. print_batch_step: 10
  6. output_dir: ./output/rec/syn/svtr_base_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/syn/predicts_svtr_base_nrtr.txt
  22. use_amp: True
  23. Optimizer:
  24. name: AdamW
  25. lr: 0.0005 # for 4gpus bs256/gpu
  26. weight_decay: 0.05
  27. filter_bias_and_bn: True
  28. LRScheduler:
  29. name: CosineAnnealingLR
  30. warmup_epoch: 6
  31. Architecture:
  32. model_type: rec
  33. algorithm: NRTR
  34. in_channels: 3
  35. Transform:
  36. Encoder:
  37. name: SVTRNet
  38. img_size: [32, 100]
  39. out_char_num: 25
  40. out_channels: 256
  41. patch_merging: 'Conv'
  42. embed_dim: [128, 256, 384]
  43. depth: [6, 6, 6]
  44. num_heads: [4, 8, 12]
  45. mixer: ['Conv','Conv','Conv','Conv','Conv','Conv', 'Conv','Conv', 'Global','Global','Global','Global','Global','Global','Global','Global','Global','Global']
  46. local_mixer: [[5, 5], [5, 5], [5, 5]]
  47. last_stage: False
  48. prenorm: True
  49. Decoder:
  50. name: NRTRDecoder
  51. num_encoder_layers: -1
  52. beam_size: 0
  53. num_decoder_layers: 6
  54. nhead: 12
  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: STRLMDBDataSet
  69. data_dir: ./
  70. transforms:
  71. - DecodeImage: # load image
  72. img_mode: BGR
  73. channel_first: False
  74. # - SVTRRecAug:
  75. - ARLabelEncode: # Class handling label
  76. character_dict_path: *character_dict_path
  77. use_space_char: *use_space_char
  78. max_text_length: *max_text_length
  79. - SVTRResize:
  80. image_shape: [3, 32, 100]
  81. padding: False
  82. - KeepKeys:
  83. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  84. loader:
  85. shuffle: True
  86. batch_size_per_card: 256
  87. drop_last: True
  88. num_workers: 4
  89. Eval:
  90. dataset:
  91. name: LMDBDataSet
  92. data_dir: ../evaluation/
  93. transforms:
  94. - DecodeImage: # load image
  95. img_mode: BGR
  96. channel_first: False
  97. - ARLabelEncode: # Class handling label
  98. character_dict_path: *character_dict_path
  99. use_space_char: *use_space_char
  100. max_text_length: *max_text_length
  101. - SVTRResize:
  102. image_shape: [3, 32, 100]
  103. padding: False
  104. - KeepKeys:
  105. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  106. loader:
  107. shuffle: False
  108. drop_last: False
  109. batch_size_per_card: 256
  110. num_workers: 4