Skip to content

Deep face recognition pipeline with SphereFace.

License

Notifications You must be signed in to change notification settings

runauto/sphereface

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

SphereFace : Deep Hypersphere Embedding for Face Recognition

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.

Introduction

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.

License

SphereFace is released under the MIT License (refer to the LICENSE file for details).

Citing SphereFace

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}
}

Contents

  1. Update
  2. Requirements
  3. Installation
  4. Usage

Update

  • July 20, 2017
    • This repository was built.
  • To be update: pretrained models, some intermediate results and extracted features will be released soon.

Requirements

  1. Requirements for Matlab
  2. Requirements for Caffe and matcaffe (see: Caffe installation instructions)
  3. Requirements for MTCNN (see: MTCNN - face detection & alignment) and Pdollar toolbox (see: Piotr's Image & Video Matlab Toolbox).

Installation

  1. 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 submodules

    git 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

   ```

  1. 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

Usage

After successfully completing installation, you'll be ready to run all the following experiments.

Part 1: Preprocessing

Note 1: In this part, we assume you are in the directory $SPHEREFACE_ROOT/preprocess/

  1. 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
  2. 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
  3. Align faces to a canonical pose using similarity transformation.

    # In Matlab Command Window
    run code/face_align_demo.m

Part 2: Train

Note 2: In this part, we assume you are in the directory $SPHEREFACE_ROOT/train/

  1. Get a list of training images.

    mv ../preprocess/result/CASIA-WebFace-112X96 data/
    # In Matlab Command Window
    run code/get_list.m
    
  2. Train sphereface model.

    ./code/sphereface/sphereface_train.sh 0,1

Part 3: Test

Note 3: In this part, we assume you are in the directory $SPHEREFACE_ROOT/test/

  1. Extract deep features and test on LFW.

    mv ../preprocess/result/lfw-112X96 data/
    # In Matlab Command Window
    run code/evaluation.m
    

Acknowledgement

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.

About

Deep face recognition pipeline with SphereFace.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • MATLAB 95.0%
  • Shell 5.0%