Note: this repository is useless because the "weight balance" trick does not improve the performance. And you should try insightface(https://github.com/deepinsight/insightface).
The operation of user-defined op(marginInnerProduct) is completely the same as it in the sphereface-caffe.
So the operation of computing Backward gradient also uses the tricks sphereface used.
Linux (I've tested on ubuntu16.04)
Tensorflow1.4+(?)
boost cuda(if you have installed caffe, there is no problem for those libraries)
matlab
- First:
git clone https://github.com/hujun100/tensorflow-sphereface.git
cd tensorflow-sphereface
- Change the path variable TENSORFLOW and CUDA_DIR in "makefile" according to your configuration Then:
make
- Change the configuration in config.py.
cd train_test
python train.py
- Put the aligned face images to "lfw_evaluation" folder
- Change the test configuration in config.py
- Change the test_data_dir in evaluation.m
python get_lfw_features.py
cd ../lfw_evaluation
run evaluation.m
- I've get 98.10% accuracy on LFW trained on CASIA-webface. I believe a better result will be obtained if I use data augmentation(mirror, smooth, jpeg compression and so on)
Thanks to all the contributors of sphereface and caffe
Now I provide the c++ code of some useful data augmentation(shift, zoom, rotation, modHSV, modRGB and so on) in data_augmentation.hpp. You can write python code according to it to improve performance.