focalsvtr_ctc.yml 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  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_ctc/
  7. eval_epoch_step: [0, 1]
  8. eval_batch_step: [0, 500]
  9. cal_metric_during_train: True
  10. pretrained_model:
  11. checkpoints:
  12. use_tensorboard: false
  13. infer_img:
  14. # for data or label process
  15. character_dict_path: &character_dict_path
  16. # ./tools/utils/EN_symbol_dict.txt
  17. max_text_length: &max_text_length 25
  18. use_space_char: &use_space_char False
  19. save_res_path: ./output/rec/u14m_filter/predicts_focalsvtr_ctc.txt
  20. Optimizer:
  21. name: AdamW
  22. lr: 0.00065 # for 4gpus bs256/gpu
  23. weight_decay: 0.05
  24. filter_bias_and_bn: True
  25. LRScheduler:
  26. name: OneCycleLR
  27. warmup_epoch: 1.5 # pct_start 0.075*20 = 1.5ep
  28. cycle_momentum: False
  29. Architecture:
  30. model_type: rec
  31. algorithm: SVTR
  32. Transform:
  33. Encoder:
  34. name: FocalSVTR
  35. img_size: [32, 128]
  36. depths: [6, 6, 6]
  37. embed_dim: 96
  38. sub_k: [[1, 1], [2, 1], [1, 1]]
  39. focal_levels: [3, 3, 3]
  40. out_channels: 256
  41. last_stage: True
  42. Decoder:
  43. name: CTCDecoder
  44. Loss:
  45. name: CTCLoss
  46. zero_infinity: True
  47. PostProcess:
  48. name: CTCLabelDecode
  49. character_dict_path: *character_dict_path
  50. use_space_char: *use_space_char
  51. Metric:
  52. name: RecMetric
  53. main_indicator: acc
  54. is_filter: True
  55. Train:
  56. dataset:
  57. name: RatioDataSet
  58. ds_width: True
  59. padding: &padding False
  60. data_dir_list: ['../Union14M-L-LMDB-Filtered/filter_train_challenging',
  61. '../Union14M-L-LMDB-Filtered/filter_train_hard',
  62. '../Union14M-L-LMDB-Filtered/filter_train_medium',
  63. '../Union14M-L-LMDB-Filtered/filter_train_normal',
  64. '../Union14M-L-LMDB-Filtered/filter_train_easy',
  65. ]
  66. transforms:
  67. - DecodeImage: # load image
  68. img_mode: BGR
  69. channel_first: False
  70. - PARSeqAug:
  71. - CTCLabelEncode: # Class handling label
  72. character_dict_path: *character_dict_path
  73. use_space_char: *use_space_char
  74. max_text_length: *max_text_length
  75. - KeepKeys:
  76. keep_keys: ['image', 'label', 'length']
  77. sampler:
  78. name: RatioSampler
  79. scales: [[128, 32]] # w, h
  80. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  81. first_bs: &bs 256
  82. fix_bs: false
  83. divided_factor: [4, 16] # w, h
  84. is_training: True
  85. loader:
  86. shuffle: True
  87. batch_size_per_card: *bs
  88. drop_last: True
  89. max_ratio: 12
  90. num_workers: 4
  91. Eval:
  92. dataset:
  93. name: RatioDataSet
  94. ds_width: True
  95. padding: True
  96. data_dir_list: ['../evaluation/CUTE80',
  97. '../evaluation/IC13_857',
  98. '../evaluation/IC15_1811',
  99. '../evaluation/IIIT5k',
  100. '../evaluation/SVT',
  101. '../evaluation/SVTP',
  102. ]
  103. transforms:
  104. - DecodeImage: # load image
  105. img_mode: BGR
  106. channel_first: False
  107. - CTCLabelEncode: # Class handling label
  108. character_dict_path: *character_dict_path
  109. use_space_char: *use_space_char
  110. max_text_length: *max_text_length
  111. - KeepKeys:
  112. keep_keys: ['image', 'label', 'length']
  113. sampler:
  114. name: RatioSampler
  115. scales: [[128, 32]] # w, h
  116. # divide_factor: to ensure the width and height dimensions can be devided by downsampling multiple
  117. first_bs: 128
  118. fix_bs: false
  119. divided_factor: [4, 16] # w, h
  120. is_training: False
  121. loader:
  122. shuffle: False
  123. drop_last: False
  124. batch_size_per_card: 128
  125. max_ratio: 12
  126. num_workers: 4