ch_PP-OCRv2_det_cml.yml 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  1. Global:
  2. use_gpu: true
  3. epoch_num: 1200
  4. log_smooth_window: 20
  5. print_batch_step: 2
  6. save_model_dir: ./output/ch_db_mv3/
  7. save_epoch_step: 1200
  8. # evaluation is run every 5000 iterations after the 4000th iteration
  9. eval_batch_step: [3000, 2000]
  10. cal_metric_during_train: False
  11. pretrained_model:
  12. checkpoints:
  13. save_inference_dir:
  14. use_visualdl: False
  15. infer_img: doc/imgs_en/img_10.jpg
  16. save_res_path: ./output/det_db/predicts_db.txt
  17. use_amp: False
  18. amp_level: O2
  19. amp_custom_black_list: ['exp']
  20. Architecture:
  21. name: DistillationModel
  22. algorithm: Distillation
  23. model_type: det
  24. Models:
  25. Teacher:
  26. pretrained: ./pretrain_models/ch_ppocr_server_v2.0_det_train/best_accuracy
  27. freeze_params: true
  28. return_all_feats: false
  29. model_type: det
  30. algorithm: DB
  31. Transform:
  32. Backbone:
  33. name: ResNet_vd
  34. layers: 18
  35. Neck:
  36. name: DBFPN
  37. out_channels: 256
  38. Head:
  39. name: DBHead
  40. k: 50
  41. Student:
  42. pretrained:
  43. freeze_params: false
  44. return_all_feats: false
  45. model_type: det
  46. algorithm: DB
  47. Backbone:
  48. name: MobileNetV3
  49. scale: 0.5
  50. model_name: large
  51. disable_se: True
  52. Neck:
  53. name: DBFPN
  54. out_channels: 96
  55. Head:
  56. name: DBHead
  57. k: 50
  58. Student2:
  59. pretrained:
  60. freeze_params: false
  61. return_all_feats: false
  62. model_type: det
  63. algorithm: DB
  64. Transform:
  65. Backbone:
  66. name: MobileNetV3
  67. scale: 0.5
  68. model_name: large
  69. disable_se: True
  70. Neck:
  71. name: DBFPN
  72. out_channels: 96
  73. Head:
  74. name: DBHead
  75. k: 50
  76. Loss:
  77. name: CombinedLoss
  78. loss_config_list:
  79. - DistillationDilaDBLoss:
  80. weight: 1.0
  81. model_name_pairs:
  82. - ["Student", "Teacher"]
  83. - ["Student2", "Teacher"]
  84. key: maps
  85. balance_loss: true
  86. main_loss_type: DiceLoss
  87. alpha: 5
  88. beta: 10
  89. ohem_ratio: 3
  90. - DistillationDMLLoss:
  91. model_name_pairs:
  92. - ["Student", "Student2"]
  93. maps_name: "thrink_maps"
  94. weight: 1.0
  95. # act: None
  96. model_name_pairs: ["Student", "Student2"]
  97. key: maps
  98. - DistillationDBLoss:
  99. weight: 1.0
  100. model_name_list: ["Student", "Student2"]
  101. # key: maps
  102. # name: DBLoss
  103. balance_loss: true
  104. main_loss_type: DiceLoss
  105. alpha: 5
  106. beta: 10
  107. ohem_ratio: 3
  108. Optimizer:
  109. name: Adam
  110. beta1: 0.9
  111. beta2: 0.999
  112. lr:
  113. name: Cosine
  114. learning_rate: 0.001
  115. warmup_epoch: 2
  116. regularizer:
  117. name: 'L2'
  118. factor: 0
  119. PostProcess:
  120. name: DistillationDBPostProcess
  121. model_name: ["Student", "Student2", "Teacher"]
  122. # key: maps
  123. thresh: 0.3
  124. box_thresh: 0.6
  125. max_candidates: 1000
  126. unclip_ratio: 1.5
  127. Metric:
  128. name: DistillationMetric
  129. base_metric_name: DetMetric
  130. main_indicator: hmean
  131. key: "Student"
  132. Train:
  133. dataset:
  134. name: SimpleDataSet
  135. data_dir: ./train_data/icdar2015/text_localization/
  136. label_file_list:
  137. - ./train_data/icdar2015/text_localization/train_icdar2015_label.txt
  138. ratio_list: [1.0]
  139. transforms:
  140. - DecodeImage: # load image
  141. img_mode: BGR
  142. channel_first: False
  143. - DetLabelEncode: # Class handling label
  144. - CopyPaste:
  145. - IaaAugment:
  146. augmenter_args:
  147. - { 'type': Fliplr, 'args': { 'p': 0.5 } }
  148. - { 'type': Affine, 'args': { 'rotate': [-10, 10] } }
  149. - { 'type': Resize, 'args': { 'size': [0.5, 3] } }
  150. - EastRandomCropData:
  151. size: [960, 960]
  152. max_tries: 50
  153. keep_ratio: true
  154. - MakeBorderMap:
  155. shrink_ratio: 0.4
  156. thresh_min: 0.3
  157. thresh_max: 0.7
  158. - MakeShrinkMap:
  159. shrink_ratio: 0.4
  160. min_text_size: 8
  161. - NormalizeImage:
  162. scale: 1./255.
  163. mean: [0.485, 0.456, 0.406]
  164. std: [0.229, 0.224, 0.225]
  165. order: 'hwc'
  166. - ToCHWImage:
  167. - KeepKeys:
  168. keep_keys: ['image', 'threshold_map', 'threshold_mask', 'shrink_map', 'shrink_mask'] # the order of the dataloader list
  169. loader:
  170. shuffle: True
  171. drop_last: False
  172. batch_size_per_card: 8
  173. num_workers: 4
  174. Eval:
  175. dataset:
  176. name: SimpleDataSet
  177. data_dir: ./train_data/icdar2015/text_localization/
  178. label_file_list:
  179. - ./train_data/icdar2015/text_localization/test_icdar2015_label.txt
  180. transforms:
  181. - DecodeImage: # load image
  182. img_mode: BGR
  183. channel_first: False
  184. - DetLabelEncode: # Class handling label
  185. - DetResizeForTest:
  186. - NormalizeImage:
  187. scale: 1./255.
  188. mean: [0.485, 0.456, 0.406]
  189. std: [0.229, 0.224, 0.225]
  190. order: 'hwc'
  191. - ToCHWImage:
  192. - KeepKeys:
  193. keep_keys: ['image', 'shape', 'polys', 'ignore_tags']
  194. loader:
  195. shuffle: False
  196. drop_last: False
  197. batch_size_per_card: 1 # must be 1
  198. num_workers: 2