focalsvtr_nrtr_maxraio12.yml 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145
  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/focalsvtr_nrtr_maxrtio12
  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: ../ltb/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_focalsvtr_nrtr_maxrtio12.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: FocalSVTR
  39. img_size: [32, 128]
  40. depths: [6, 6, 6]
  41. embed_dim: 96
  42. sub_k: [[1, 1], [2, 1], [1, 1]]
  43. focal_levels: [3, 3, 3]
  44. last_stage: False
  45. Decoder:
  46. name: NRTRDecoder
  47. num_encoder_layers: -1
  48. beam_size: 0
  49. num_decoder_layers: 2
  50. nhead: 12
  51. max_len: *max_text_length
  52. Loss:
  53. name: ARLoss
  54. PostProcess:
  55. name: ARLabelDecode
  56. character_dict_path: *character_dict_path
  57. use_space_char: *use_space_char
  58. Metric:
  59. name: RecMetric
  60. main_indicator: acc
  61. is_filter: True
  62. Train:
  63. dataset:
  64. name: RatioDataSet
  65. ds_width: True
  66. padding: &padding True
  67. padding_rand: True
  68. padding_doub: True
  69. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  70. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  71. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  72. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  73. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  74. ]
  75. transforms:
  76. - DecodeImage: # load image
  77. img_mode: BGR
  78. channel_first: False
  79. - PARSeqAug:
  80. - ARLabelEncode: # Class handling label
  81. character_dict_path: *character_dict_path
  82. use_space_char: *use_space_char
  83. max_text_length: *max_text_length
  84. - KeepKeys:
  85. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  86. sampler:
  87. name: RatioSampler
  88. scales: [[128, 32]] # w, h
  89. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  90. first_bs: &bs 256
  91. fix_bs: false
  92. divided_factor: [4, 16] # w, h
  93. is_training: True
  94. loader:
  95. shuffle: True
  96. batch_size_per_card: *bs
  97. drop_last: True
  98. max_ratio: &max_ratio 12
  99. num_workers: 4
  100. Eval:
  101. dataset:
  102. name: RatioDataSet
  103. ds_width: True
  104. padding: False
  105. padding_rand: False
  106. data_dir_list: [
  107. '../evaluation/CUTE80',
  108. '../evaluation/IC13_857',
  109. '../evaluation/IC15_1811',
  110. '../evaluation/IIIT5k',
  111. '../evaluation/SVT',
  112. '../evaluation/SVTP',
  113. ]
  114. transforms:
  115. - DecodeImage: # load image
  116. img_mode: BGR
  117. channel_first: False
  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: 128
  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. max_ratio: *max_ratio
  136. batch_size_per_card: 128
  137. num_workers: 4