focalsvtr_parseq_maxratio12.yml 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140
  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_parseq_maxratio12
  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_parseq_maxratio12.txt
  22. use_amp: True
  23. Optimizer:
  24. name: AdamW
  25. lr: 0.00065 # 4gpus 256bs/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: PARSeq
  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: PARSeqDecoder
  47. decode_ar: True
  48. refine_iters: 1
  49. Loss:
  50. name: PARSeqLoss
  51. PostProcess:
  52. name: ARLabelDecode
  53. character_dict_path: *character_dict_path
  54. use_space_char: *use_space_char
  55. Metric:
  56. name: RecMetric
  57. main_indicator: acc
  58. is_filter: True
  59. Train:
  60. dataset:
  61. name: RatioDataSetTVResize
  62. ds_width: True
  63. padding: &padding True
  64. padding_rand: True
  65. padding_doub: True
  66. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_filter_train_challenging',
  67. '../Union14M-L-LMDB-Filtered/filter_filter_train_hard',
  68. '../Union14M-L-LMDB-Filtered/filter_filter_train_medium',
  69. '../Union14M-L-LMDB-Filtered/filter_filter_train_normal',
  70. '../Union14M-L-LMDB-Filtered/filter_filter_train_easy',
  71. ]
  72. transforms:
  73. - DecodeImagePIL: # load image
  74. img_mode: RGB
  75. - PARSeqAugPIL:
  76. - ARLabelEncode: # Class handling label
  77. character_dict_path: *character_dict_path
  78. use_space_char: *use_space_char
  79. max_text_length: *max_text_length
  80. - KeepKeys:
  81. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  82. sampler:
  83. name: RatioSampler
  84. scales: [[128, 32]] # w, h
  85. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  86. first_bs: &bs 256
  87. fix_bs: false
  88. divided_factor: [4, 16] # w, h
  89. is_training: True
  90. loader:
  91. shuffle: True
  92. batch_size_per_card: *bs
  93. drop_last: True
  94. max_ratio: &max_ratio 12
  95. num_workers: 4
  96. Eval:
  97. dataset:
  98. name: RatioDataSetTVResize
  99. ds_width: True
  100. padding: False
  101. padding_rand: False
  102. data_dir_list: [
  103. '../evaluation/CUTE80',
  104. '../evaluation/IC13_857',
  105. '../evaluation/IC15_1811',
  106. '../evaluation/IIIT5k',
  107. '../evaluation/SVT',
  108. '../evaluation/SVTP',
  109. ]
  110. transforms:
  111. - DecodeImagePIL: # load image
  112. img_mode: RGB
  113. - ARLabelEncode: # Class handling label
  114. character_dict_path: *character_dict_path
  115. use_space_char: *use_space_char
  116. max_text_length: *max_text_length
  117. - KeepKeys:
  118. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  119. sampler:
  120. name: RatioSampler
  121. scales: [[128, 32]] # w, h
  122. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  123. first_bs: 128
  124. fix_bs: false
  125. divided_factor: [4, 16] # w, h
  126. is_training: False
  127. loader:
  128. shuffle: False
  129. drop_last: False
  130. max_ratio: *max_ratio
  131. batch_size_per_card: 128
  132. num_workers: 4