MobileFaceNet.yaml 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. # global configs
  2. Global:
  3. checkpoints: null
  4. pretrained_model: null
  5. output_dir: ./output/
  6. device: gpu
  7. save_interval: 1
  8. eval_during_train: True
  9. eval_interval: 1
  10. epochs: 25
  11. print_batch_step: 20
  12. use_visualdl: False
  13. eval_mode: face_recognition
  14. retrieval_feature_from: backbone
  15. flip_test: True
  16. feature_normalize: False
  17. re_ranking: False
  18. use_dali: False
  19. # used for static mode and model export
  20. image_shape: [3, 112, 112]
  21. save_inference_dir: ./inference
  22. AMP:
  23. use_amp: True
  24. use_fp16_test: False
  25. scale_loss: 27648
  26. use_dynamic_loss_scaling: True
  27. use_promote: False
  28. # O1: mixed fp16
  29. level: O1
  30. # model architecture
  31. Arch:
  32. name: RecModel
  33. infer_output_key: features
  34. infer_add_softmax: False
  35. Backbone:
  36. name: MobileFaceNet
  37. Head:
  38. name: ArcMargin
  39. embedding_size: 128
  40. class_num: 93431
  41. margin: 0.5
  42. scale: 64
  43. # loss function config for traing/eval process
  44. Loss:
  45. Train:
  46. - CELoss:
  47. weight: 1.0
  48. Optimizer:
  49. name: AdamW
  50. beta1: 0.9
  51. beta2: 0.999
  52. epsilon: 1e-8
  53. weight_decay: 0.05
  54. one_dim_param_no_weight_decay: True
  55. lr:
  56. # for 8 cards
  57. name: Cosine
  58. learning_rate: 4e-3 # lr 4e-3 for total_batch_size 1024
  59. eta_min: 1e-6
  60. warmup_epoch: 1
  61. warmup_start_lr: 0
  62. # data loader for train and eval
  63. DataLoader:
  64. Train:
  65. dataset:
  66. name: ImageNetDataset
  67. image_root: dataset/MS1M_v3/
  68. cls_label_path: dataset/MS1M_v3/label.txt
  69. transform_ops:
  70. - DecodeImage:
  71. to_rgb: True
  72. channel_first: False
  73. backend: cv2
  74. - RandFlipImage:
  75. flip_code: 1
  76. - ResizeImage:
  77. size: [112, 112]
  78. return_numpy: False
  79. interpolation: bilinear
  80. backend: cv2
  81. - NormalizeImage:
  82. scale: 1.0/255.0
  83. mean: [0.5, 0.5, 0.5]
  84. std: [0.5, 0.5, 0.5]
  85. order: hwc
  86. sampler:
  87. name: DistributedBatchSampler
  88. batch_size: 128
  89. drop_last: False
  90. shuffle: True
  91. loader:
  92. num_workers: 8
  93. use_shared_memory: True
  94. Eval:
  95. dataset:
  96. name: FaceEvalDataset
  97. transform_ops:
  98. - DecodeImage:
  99. to_rgb: True
  100. channel_first: False
  101. backend: cv2
  102. - ResizeImage:
  103. size: [112, 112]
  104. return_numpy: False
  105. interpolation: bilinear
  106. backend: cv2
  107. - NormalizeImage:
  108. scale: 1.0/255.0
  109. mean: [0.5, 0.5, 0.5]
  110. std: [0.5, 0.5, 0.5]
  111. order: hwc
  112. sampler:
  113. name: DistributedBatchSampler
  114. batch_size: 64
  115. drop_last: False
  116. shuffle: False
  117. loader:
  118. num_workers: 4
  119. use_shared_memory: True
  120. Metric:
  121. Eval:
  122. - FaceAccuracy: {}