kie_unet_sdmgr.yml 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111
  1. Global:
  2. use_gpu: True
  3. epoch_num: 60
  4. log_smooth_window: 20
  5. print_batch_step: 50
  6. save_model_dir: ./output/kie_5/
  7. save_epoch_step: 50
  8. # evaluation is run every 5000 iterations after the 4000th iteration
  9. eval_batch_step: [ 0, 80 ]
  10. # 1. If pretrained_model is saved in static mode, such as classification pretrained model
  11. # from static branch, load_static_weights must be set as True.
  12. # 2. If you want to finetune the pretrained models we provide in the docs,
  13. # you should set load_static_weights as False.
  14. load_static_weights: False
  15. cal_metric_during_train: False
  16. pretrained_model:
  17. checkpoints:
  18. save_inference_dir:
  19. use_visualdl: False
  20. class_path: &class_path ./train_data/wildreceipt/class_list.txt
  21. infer_img: ./train_data/wildreceipt/1.txt
  22. save_res_path: ./output/sdmgr_kie/predicts_kie.txt
  23. img_scale: [ 1024, 512 ]
  24. Architecture:
  25. model_type: kie
  26. algorithm: SDMGR
  27. Transform:
  28. Backbone:
  29. name: Kie_backbone
  30. Head:
  31. name: SDMGRHead
  32. Loss:
  33. name: SDMGRLoss
  34. Optimizer:
  35. name: Adam
  36. beta1: 0.9
  37. beta2: 0.999
  38. lr:
  39. name: Piecewise
  40. learning_rate: 0.001
  41. decay_epochs: [ 60, 80, 100]
  42. values: [ 0.001, 0.0001, 0.00001]
  43. warmup_epoch: 2
  44. regularizer:
  45. name: 'L2'
  46. factor: 0.00005
  47. PostProcess:
  48. name: None
  49. Metric:
  50. name: KIEMetric
  51. main_indicator: hmean
  52. Train:
  53. dataset:
  54. name: SimpleDataSet
  55. data_dir: ./train_data/wildreceipt/
  56. label_file_list: [ './train_data/wildreceipt/wildreceipt_train.txt' ]
  57. ratio_list: [ 1.0 ]
  58. transforms:
  59. - DecodeImage: # load image
  60. img_mode: RGB
  61. channel_first: False
  62. - NormalizeImage:
  63. scale: 1
  64. mean: [ 123.675, 116.28, 103.53 ]
  65. std: [ 58.395, 57.12, 57.375 ]
  66. order: 'hwc'
  67. - KieLabelEncode: # Class handling label
  68. character_dict_path: ./train_data/wildreceipt/dict.txt
  69. class_path: *class_path
  70. - KieResize:
  71. - ToCHWImage:
  72. - KeepKeys:
  73. keep_keys: [ 'image', 'relations', 'texts', 'points', 'labels', 'tag', 'shape'] # dataloader will return list in this order
  74. loader:
  75. shuffle: True
  76. drop_last: False
  77. batch_size_per_card: 4
  78. num_workers: 4
  79. Eval:
  80. dataset:
  81. name: SimpleDataSet
  82. data_dir: ./train_data/wildreceipt
  83. label_file_list:
  84. - ./train_data/wildreceipt/wildreceipt_test.txt
  85. transforms:
  86. - DecodeImage: # load image
  87. img_mode: RGB
  88. channel_first: False
  89. - KieLabelEncode: # Class handling label
  90. character_dict_path: ./train_data/wildreceipt/dict.txt
  91. - KieResize:
  92. - NormalizeImage:
  93. scale: 1
  94. mean: [ 123.675, 116.28, 103.53 ]
  95. std: [ 58.395, 57.12, 57.375 ]
  96. order: 'hwc'
  97. - ToCHWImage:
  98. - KeepKeys:
  99. keep_keys: [ 'image', 'relations', 'texts', 'points', 'labels', 'tag', 'ori_image', 'ori_boxes', 'shape']
  100. loader:
  101. shuffle: False
  102. drop_last: False
  103. batch_size_per_card: 1 # must be 1
  104. num_workers: 4