This branch is developed for deep face recognition
Clone or download
#4 Compare This branch is 10 commits ahead, 361 commits behind BVLC:master.
Latest commit 48ff38e Aug 21, 2017
Permalink
Failed to load latest commit information.
cmake make cmake find cuDNN on Mac OS Aug 18, 2016
data Merge pull request #4455 from ShaggO/spaceSupportILSVRC12MNIST Jul 14, 2016
docker Update Dockerfile to cuDNN v5 May 16, 2016
docs Fix: docs/yum_install.md glog broken link Oct 5, 2016
examples fix typo in pascal_multilabel_datalayers.py Oct 5, 2016
face_example update readme Oct 14, 2016
include/caffe v1.0 Oct 9, 2016
matlab show Caffe's version from MatCaffe Jan 23, 2016
mnist_example update readme Oct 14, 2016
models [examples] switch examples + models to Input layers Feb 26, 2016
python Merge pull request #4343 from nitnelave/python/top_names Jul 13, 2016
scripts NV changed path to cudnn Oct 1, 2016
src v1.0 Oct 9, 2016
tools Update parse_log.py Jul 11, 2016
.Doxyfile update doxygen config to stop warnings Sep 3, 2014
.gitignore Ignore Visual Studio Code files. Sep 27, 2016
.travis.yml Stop setting cache timeout in TravisCI Jul 15, 2016
CMakeLists.txt [build] (CMake) customisable Caffe version/soversion May 10, 2016
CONTRIBUTING.md [docs] add CONTRIBUTING.md which will appear on GitHub new Issue/PR p… Jul 30, 2015
CONTRIBUTORS.md clarify the license and copyright terms of the project Aug 7, 2014
INSTALL.md installation questions -> caffe-users Oct 19, 2015
LICENSE v1.0 Oct 9, 2016
LICENSE-Caffe v1.0 Oct 9, 2016
Makefile [build] set default BLAS include for OS X 10.11 Aug 18, 2016
Makefile.config.example [build] note that `make clean` clears build and distribute dirs May 4, 2016
README.md Update README.md Aug 21, 2017
caffe.cloc [fix] stop cloc complaint about cu type Sep 4, 2014

README.md

Deep Face Recognition with Caffe Implementation

This branch is developed for deep face recognition, the related paper is as follows.

A Discriminative Feature Learning Approach for Deep Face Recognition[C]
Yandong Wen, Kaipeng Zhang, Zhifeng Li*, Yu Qiao
European Conference on Computer Vision. Springer International Publishing, 2016: 499-515.

Updates

  • Oct 13, 2016
    • A demo for extracting deep feature by the given model is provided.
  • Oct 12, 2016
  • Otc 9, 2016
    • The code and training prototxt for our ECCV16 paper are released.
    • If you train our Network on CAISA-WebFace, the expected verification performance of SINGLE MODEL on LFW should be ~99%.

Files

  • Original Caffe library
  • Center Loss
    • src/caffe/proto/caffe.proto
    • include/caffe/layers/center_loss_layer.hpp
    • src/caffe/layers/center_loss_layer.cpp
    • src/caffe/layers/center_loss_layer.cu
  • face_example
    • face_example/data/
    • face_example/face_snapshot/
    • face_example/face_train_test.prototxt
    • face_example/face_solver.prototxt
    • face_example/face_deploy.prototxt
    • face_example/extractDeepFeature.m
  • mnist_example
    • mnist_example/data/
    • mnist_example/face_snapshot/
    • mnist_example/mnist_train_test.prototxt
    • mnist_example/mnist_solver.prototxt
    • mnist_example/mnist_deploy.prototxt

Train_Model

  1. The Installation completely the same as Caffe. Please follow the installation instructions. Make sure you have correctly installed before using our code.

  2. Download the face dataset for training, e.g. CAISA-WebFace, VGG-Face, MS-Celeb-1M, MegaFace.

  3. Preprocess the training face images, including detection, alignment, etc. Here we strongly recommend MTCNN, which is an effective and efficient open-source tool for face detection and alignment.

  4. Creat list for training set and validation set. Place them in face_example/data/

  5. Specify your data source for train & val

     layer {
       name: "data"
       type: "ImageData"
       top: "data"
       top: "label"
       image_data_param {
         source: "face_example/data/###your_list###"
       }
     }
    
  6. Specify the number of subject in FC6 layer

     layer {
       name: "fc6"
       type: "InnerProduct"
       bottom: "fc5"
       top: "fc6"
       inner_product_param {
         num_output: ##number##
       }
     }
    
  7. Specify the loss weight and the number of subject in center loss layer

     layer {
       name: "center_loss"
       type: "CenterLoss"
       bottom: "fc5"
       bottom: "label"
       top: "center_loss"
       loss_weight: ##weight##
       center_loss_param {
         num_output: ##number##
       }
     }
    
  8. Train model

     cd $CAFFE-FACE_ROOT
     ./build/tools/caffe train -solver face_example/face_solver.prototxt -gpu X,Y
    

Extract_DeepFeature

  1. Compile matcaffe by make matcaffe

  2. Specify the correspinding paths in face_example/extractDeepFeature.m

     addpath('path_to_matCaffe/matlab');
     model = 'path_to_deploy/face_deploy.prototxt';
     weights = 'path_to_model/face_model.caffemodel';
     image = imread('path_to_image/Jennifer_Aniston_0016.jpg');
    
  3. Run extractDeepFeature.m in Matlab

Contact

Citation

You are encouraged to cite the following paper if it helps your research.

@inproceedings{wen2016discriminative,
  title={A Discriminative Feature Learning Approach for Deep Face Recognition},
  author={Wen, Yandong and Zhang, Kaipeng and Li, Zhifeng and Qiao, Yu},
  booktitle={European Conference on Computer Vision},
  pages={499--515},
  year={2016},
  organization={Springer}
}

License

Copyright (c) Yandong Wen

All rights reserved.

MIT License

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.