focalnet_base_ctc.yml 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  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/focalnet_base_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 ./tools/utils/EN_symbol_dict.txt
  16. max_text_length: &max_text_length 25
  17. use_space_char: &use_space_char False
  18. save_res_path: ./output/rec/predicts_svtr_tiny.txt
  19. use_amp: True
  20. Optimizer:
  21. name: AdamW
  22. lr: 0.00065
  23. weight_decay: 0.05
  24. filter_bias_and_bn: True
  25. LRScheduler:
  26. name: OneCycleLR
  27. # warmup_epoch: 2
  28. warmup_epoch: 1.5 # pct_start 0.075*20 = 1.5ep
  29. cycle_momentum: False
  30. Architecture:
  31. model_type: rec
  32. algorithm: SVTR
  33. Transform:
  34. Encoder:
  35. name: FocalSVTR
  36. img_size: [32, 128]
  37. depths: [2, 2, 9, 2]
  38. embed_dim: 96
  39. sub_k: [[2, 1], [1, 1], [1, 1], [1, 1]]
  40. focal_levels: [3, 3, 3, 3]
  41. max_khs: [7, 3, 3, 3]
  42. focal_windows: [3, 3, 3, 3]
  43. out_channels: 384
  44. last_stage: True
  45. Decoder:
  46. name: CTCDecoder
  47. Loss:
  48. name: CTCLoss
  49. zero_infinity: True
  50. PostProcess:
  51. name: CTCLabelDecode
  52. character_dict_path: *character_dict_path
  53. use_space_char: *use_space_char
  54. Metric:
  55. name: RecMetric
  56. main_indicator: acc
  57. is_filter: True
  58. Train:
  59. dataset:
  60. name: LMDBDataSet
  61. data_dir: ../Union14M-L-LMDB-Filtered
  62. transforms:
  63. - DecodeImagePIL: # load image
  64. img_mode: RGB
  65. - PARSeqAugPIL:
  66. - CTCLabelEncode: # Class handling label
  67. character_dict_path: *character_dict_path
  68. use_space_char: *use_space_char
  69. max_text_length: *max_text_length
  70. - RecTVResize:
  71. image_shape: [32, 128]
  72. padding: False
  73. - KeepKeys:
  74. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  75. loader:
  76. shuffle: True
  77. batch_size_per_card: 256
  78. drop_last: True
  79. num_workers: 4
  80. Eval:
  81. dataset:
  82. name: LMDBDataSet
  83. data_dir: ../evaluation/
  84. transforms:
  85. - DecodeImagePIL: # load image
  86. img_mode: RGB
  87. - CTCLabelEncode: # Class handling label
  88. character_dict_path: *character_dict_path
  89. use_space_char: *use_space_char
  90. max_text_length: *max_text_length
  91. - RecTVResize:
  92. image_shape: [32, 128]
  93. padding: False
  94. - KeepKeys:
  95. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  96. loader:
  97. shuffle: False
  98. drop_last: False
  99. batch_size_per_card: 256
  100. num_workers: 2