svtrv2_nrtr.yml 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146
  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/svtrv2_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_svtrv2_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: NRTR
  35. in_channels: 3
  36. Transform:
  37. Encoder:
  38. name: SVTRNet
  39. img_size: [32, 128]
  40. out_char_num: 25
  41. out_channels: 256
  42. patch_merging: 'Conv'
  43. embed_dim: [128, 256, 384]
  44. depth: [6, 6, 6]
  45. num_heads: [4, 8, 12]
  46. mixer: ['Conv','Conv','Conv','Conv','Conv','Conv', 'Conv','Conv', 'Global','Global','Global','Global','Global','Global','Global','Global','Global','Global']
  47. local_mixer: [[5, 5], [5, 5], [5, 5]]
  48. last_stage: False
  49. prenorm: True
  50. Decoder:
  51. name: NRTRDecoder
  52. num_encoder_layers: -1
  53. beam_size: 0
  54. num_decoder_layers: 2
  55. nhead: 12
  56. max_len: *max_text_length
  57. Loss:
  58. name: ARLoss
  59. PostProcess:
  60. name: ARLabelDecode
  61. character_dict_path: *character_dict_path
  62. use_space_char: *use_space_char
  63. Metric:
  64. name: RecMetric
  65. main_indicator: acc
  66. is_filter: True
  67. Train:
  68. dataset:
  69. name: RatioDataSetTVResize
  70. ds_width: True
  71. padding: false
  72. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  73. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  74. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  75. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  76. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  77. ]
  78. transforms:
  79. - DecodeImagePIL: # load image
  80. img_mode: RGB
  81. - PARSeqAugPIL:
  82. - ARLabelEncode: # Class handling label
  83. character_dict_path: *character_dict_path
  84. use_space_char: *use_space_char
  85. max_text_length: *max_text_length
  86. - KeepKeys:
  87. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  88. sampler:
  89. name: RatioSampler
  90. scales: [[128, 32]] # w, h
  91. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  92. first_bs: &bs 256
  93. fix_bs: false
  94. divided_factor: [4, 16] # w, h
  95. is_training: True
  96. loader:
  97. shuffle: True
  98. batch_size_per_card: *bs
  99. drop_last: True
  100. max_ratio: &max_ratio 4
  101. num_workers: 4
  102. Eval:
  103. dataset:
  104. name: RatioDataSetTVResize
  105. ds_width: True
  106. padding: False
  107. data_dir_list: [
  108. '../evaluation/CUTE80',
  109. '../evaluation/IC13_857',
  110. '../evaluation/IC15_1811',
  111. '../evaluation/IIIT5k',
  112. '../evaluation/SVT',
  113. '../evaluation/SVTP',
  114. ]
  115. transforms:
  116. - DecodeImagePIL: # load image
  117. img_mode: RGB
  118. - ARLabelEncode: # Class handling label
  119. character_dict_path: *character_dict_path
  120. use_space_char: *use_space_char
  121. max_text_length: *max_text_length
  122. - KeepKeys:
  123. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  124. sampler:
  125. name: RatioSampler
  126. scales: [[128, 32]] # w, h
  127. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  128. first_bs: *bs
  129. fix_bs: false
  130. divided_factor: [4, 16] # w, h
  131. is_training: False
  132. loader:
  133. shuffle: False
  134. drop_last: False
  135. batch_size_per_card: *bs
  136. max_ratio: *max_ratio
  137. num_workers: 4