focalsvtr_rctc.yml 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107
  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_rctc/
  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/u14m_filter/predicts_svtr_tiny.txt
  19. use_amp: True
  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, 9]
  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: false
  42. feat2d: True
  43. Decoder:
  44. name: RCTCDecoder
  45. Loss:
  46. name: CTCLoss
  47. zero_infinity: True
  48. PostProcess:
  49. name: CTCLabelDecode
  50. character_dict_path: *character_dict_path
  51. use_space_char: *use_space_char
  52. Metric:
  53. name: RecMetric
  54. main_indicator: acc
  55. is_filter: True
  56. Train:
  57. dataset:
  58. name: LMDBDataSet
  59. data_dir: ../Union14M-L-LMDB-Filtered
  60. transforms:
  61. - DecodeImagePIL: # load image
  62. img_mode: RGB
  63. - PARSeqAugPIL:
  64. - CTCLabelEncode: # Class handling label
  65. character_dict_path: *character_dict_path
  66. use_space_char: *use_space_char
  67. max_text_length: *max_text_length
  68. - RecTVResize:
  69. image_shape: [32, 128]
  70. padding: False
  71. - KeepKeys:
  72. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  73. loader:
  74. shuffle: True
  75. batch_size_per_card: 256
  76. drop_last: True
  77. num_workers: 4
  78. Eval:
  79. dataset:
  80. name: LMDBDataSet
  81. data_dir: ../evaluation/
  82. transforms:
  83. - DecodeImagePIL: # load image
  84. img_mode: RGB
  85. - CTCLabelEncode: # Class handling label
  86. character_dict_path: *character_dict_path
  87. use_space_char: *use_space_char
  88. max_text_length: *max_text_length
  89. - RecTVResize:
  90. image_shape: [32, 128]
  91. padding: False
  92. - KeepKeys:
  93. keep_keys: ['image', 'label', 'length'] # dataloader will return list in this order
  94. loader:
  95. shuffle: False
  96. drop_last: False
  97. batch_size_per_card: 256
  98. num_workers: 2