A re-implementation of sphereface.
Introduction
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.
Requirements
Linux (I've tested on ubuntu16.04)
Tensorflow1.4+(?)
boost cuda(if you have installed caffe, there is no problem for those libraries)
matlab
Installation
- 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
Train
- Change the configuration in config.py.
cd train_test
python train.py
Test(LFW)
- 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
Result(LFW)
- 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)
Reference
Thanks to all the contributors of sphereface and caffe
Others
Data augmentation
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.