By Weiyang Liu, Yandong Wen, Zhiding Yu, Ming Li, Bhiksha Raj and Le Song
SphereFace was initially described in an arXiv technical report and was then published in CVPR 2017.
The repository contains the entire pipeline (including all the preprossings) for deep face recognition with SphereFace. The recognition pipeline contains three major steps: Face detection, face alignment and face recognition. To facilitate all the reseachers, we specify all these three steps in the repository. SphereFace is our proposed face recognition method. For face detection, we use the MT-CNN.
The provided network prototxt example is a 28-layer CNN, which is the same as Center Face. To fully reproduce the results in the paper, you need to make some modifications (e.g. network architecture) according to the SphereFace paper.
SphereFace is released under the MIT License (refer to the LICENSE file for details).
If you find SphereFace useful in your research, please consider to cite:
@inproceedings{liu2017sphereface,
author = {Weiyang Liu, Yandong Wen, Zhiding Yu, Ming Li, Bhiksha Raj, and Le Song},
title = {SphereFace: Deep Hypersphere Embedding for Face Recognition},
booktitle = {Proceedings of the IEEE conference on computer vision and pattern recognition},
Year = {2017}
}
- July 20, 2017
- This repository was built.
- To be update: pretrained models, some intermediate results and extracted features will be released soon.
- Requirements for
Matlab
- Requirements for
Caffe
andmatcaffe
(see: Caffe installation instructions) - Requirements for
MTCNN
(see: MTCNN - face detection & alignment) andPdollar toolbox
(see: Piotr's Image & Video Matlab Toolbox).
-
Clone the SphereFace repository. We'll call the directory that you cloned SphereFace into
SPHEREFACE_ROOT
git clone --recursive https://github.com/wy1iu/sphereface.git
or first clone the SphereFace repository and then clone the
MTCNN
&pdollar toolbox
as submodulesgit clone https://github.com/wy1iu/sphereface.git cd $SPHEREFACE_ROOT/tools git clone https://github.com/kpzhang93/MTCNN_face_detection_alignment.git git clone https://github.com/pdollar/toolbox.git
```
-
Build Caffe and matcaffe
cd $SPHEREFACE_ROOT/tools/caffe-sphereface # Now follow the Caffe installation instructions here: # http://caffe.berkeleyvision.org/installation.html # If you're experienced with Caffe and have all of the requirements installed # and your Makefile.config in place, then simply do: make -j8 && make matcaffe
After successfully completing installation, you'll be ready to run all the following experiments.
Note 1: In this part, we assume you are in the directory $SPHEREFACE_ROOT/preprocess/
-
Download the training set (
CASIA-WebFace
) and test set (LFW
) and place them in $SPHEREFACE_ROOT/preprocess/data/.cd $SPHEREFACE_ROOT/preprocess mv /your_path/CASIA_WebFace data/ ./code/get_lfw.sh tar xvf data/lfw.tgz
-
Detect faces and facial landmarks in CAISA-WebFace and LFW datasets using
MTCNN
(see: MTCNN - face detection & alignment).# In Matlab Command Window run code/face_detect_demo.m
-
Align faces to a canonical pose using similarity transformation.
# In Matlab Command Window run code/face_align_demo.m
Note 2: In this part, we assume you are in the directory $SPHEREFACE_ROOT/train/
-
Get a list of training images.
mv ../preprocess/result/CASIA-WebFace-112X96 data/ # In Matlab Command Window run code/get_list.m
-
Train sphereface model.
./code/sphereface/sphereface_train.sh 0,1
Note 3: In this part, we assume you are in the directory $SPHEREFACE_ROOT/test/
-
Extract deep features and test on LFW.
mv ../preprocess/result/lfw-112X96 data/ # In Matlab Command Window run code/evaluation.m
This repository and the face recognition pipeline are largely contributed by Yandong Wen, who I personally learn a lot from. This repository will not even be possible without him. We also would like to sincerely thank Kaipeng Zhang for providing us with the amazing face detection method.
Questions can be left as issues in the repository. We will be happy to answer them.