README.md

May 22, 2018 ยท View on GitHub

Insight Face in TensorFlow

Tasks

  • mxnet dataset to tfrecords
  • backbone network architectures [vgg16, vgg19, resnet]
  • backbone network architectures [resnet-se, resnext]
  • LResNet50E-IR
  • LResNet100E-IR
  • Additive Angular Margin Loss
  • CosineFace Loss
  • train network code
  • add validate during training
  • multi-gpu training
  • combine losses contributed by RogerLo.
  • evaluate code

Training Tips(Continual updates)

  • If you can't use large batch size(>128), you should use small learning rate
  • If you can't use large batch size(>128), you can try batch renormalization(file L_Resnet_E_IR_RBN.py)
  • If use multiple gpus, you should keep at least 16 images each gpu.
  • Try Group Normalization, you can use the code L_Resnet_E_IR_GBN.py
  • Using the current model, and the lr schedule in train_nets.py, you can get the results as model c
  • The bug about model size is 1.6G have fixed based on issues #9. If you want to get a small model, you should use L_Resnet_E_IR_fix_issues9.py
  • multi-gpu training code's bug have fixed. If you want to use the correct version, you should use train_nets_mgpu_new.py

Training models (Continual updates)

model A
model namedepthnormalization layerbatch sizetotal_stepsdownloadpassword
model A50group normalization161060kmodel a2q72
accuracy
dbnameaccuracy
lfw0.9897
cfp_ff0.9876
cfp_fp0.84357
age_db300.914
model B
model namedepthnormalization layerbatch sizetotal_stepsdownloadpassword
model B50batch normalization161100kmodel_bh6ai
accuracy
dbnameaccuracy
lfw0.9933
cfp_ff0.99357
cfp_fp0.8766
age_db300.9342
model C
model namedepthnormalization layerbatch sizetotal_stepsdownloadpassword
model C50batch normalization161950kmodel_c8mdi
accuracy
dbnameaccuracy
lfw0.9963
cfp_ff0.99586
cfp_fp0.9087
age_db300.96367
model D
model namedepthnormalization layerbatch sizetotal_stepsmodel_sizedownloadpassword
model D50batch normalization136710k348.9MBmodel_damdt
accuracy
dbnameaccuracy
lfw0.9968
cfp_ff0.9973
cfp_fp0.9271
age_db300.9725

Requirements

  1. TensorFlow 1.4 1.6
  2. TensorLayer 1.7
  3. cuda8&cudnn6 or cuda9&cudnn7
  4. Python3

Max Batch Size Test

Environment
GPUcudacudnnTensorFlowTensorLayerMaxnetGluon
Titan xp9.07.01.61.71.1.01.1.0
Results
DL ToolsMax BatchSize(without bn and prelu)Max BatchSize(with bn only)Max BatchSize(with prelu only)Max BatchSize(with bn and prelu)
TensorLayer(8000, 9000)(5000, 6000)(3000, 4000)(2000, 3000)
Mxnet(40000, 50000)(20000, 30000)(20000, 30000)(10000, 20000)
Gluon(7000, 8000)(3000, 4000)no official methodNone

(8000, 9000) : 8000 without OOM, 9000 OOM Error

Test Code
TensorLayerMaxnetGluon
tensorlayer_batchsize_test.pymxnet_batchsize_test.pygluon_batchsize_test.py

References

  1. InsightFace mxnet
  2. InsightFace : Additive Angular Margin Loss for Deep Face Recognition
  3. Group Normalization
  4. tensorlayer_vgg16
  5. tensorlayer_vgg19
  6. tf_slim
  7. Deep Residual Learning for Image Recognition
  8. Very Deep Convolutional Networks For Large-Scale Image Recognition
  9. Squeeze-and-Excitation Networks