Skip to content
forked from happynear/NormFace

NormFace: L2 HyperSphere Embedding for Face Verification, 99.21% on LFW

License

Notifications You must be signed in to change notification settings

zzpfox/NormFace

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

75 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NormFace

NormFace: L2 HyperSphere Embedding for Face Verification

https://www.cs.jhu.edu/~alanlab/Pubs17/wang2017normface.pdf

Announcement: Current arXiv version refers to a wrong result for A-softmax. I made a mistake when counting the depth of my CNN. The value 99.26% is for ResNet-20, while my CNN is ResNet-27.

Baseline Model Original Accuracy Finetune Using Normalization
Light CNN(MaxOut)   98.41%*   98.78%
Center Face(ResNet) 99.03% 99.21%

* It is 98.13% on Light CNN's project page. After applying the mirror face trick, it becomes 98.41%.

Requirements

  1. My Caffe (https://github.com/happynear/caffe-windows/tree/ms). It also works on Linux. Anyway, if you want to use your own Caffe, please transplant the inner_product_layer, inner_distance_layer, normalize_layer, general_contrastive_layer, flip_layer and accuracy_layer to your Caffe. Since there are too many layers to transplant, I suggest you to use my Caffe directly:)
  2. Matlab to draw some figures.
  3. GPU with CUDA support.
  4. MTCNN face and facial landmark detector(https://github.com/kpzhang93/MTCNN_face_detection_alignment).
  5. Baseline model such as Center Face or Light CNN or your own model trained by softmax loss. I don't know whether my loss helps or not if your model is trained by other loss functions. You may have a try. I believe it will be effective if there is no normalization term in your model.

Train

  1. The dataset used in this paper is CASIA-Webface. Note that there are 3 identities overlap between CASIA-Webface and LFW. They are 0166921, 1056413 and 1193098. For fair evaluation, it is recommended to remove them from CAISA-Webface.
  2. Align all face images using MTCNN. The script can be found in my another github repository.
  3. Replace the final inner-product layer and softmax layer with layers defined in scaled_cosine_softmax.prototxt or normalized_Euclidean_contrastive.prototxt.
  4. Fine-tune the network based on the original model using a small learning rate, say 0.001 or 0.0001.

Evaluation

Evaluation codes are in my another github repository. Please refer to the second paragraph of the Update section.

A trick called mirror face is used during extracting the features. A sample code is in ./prototxt/example_of_mirror_face.prototxt.

About the mirror face: See ./MirrorFace.md

About the histogram feature for video face verification: Details are in ./YTF.

Trained Models

Light CNN B model(98.78%): Google Drive or Baidu Yun.

ps: I used to get a model of 98.8%, but I lost it....

Center Face (ResNet-27) model(99.21%): Google Drive or Baidu Yun.

License

This code is distributed under MIT LICENSE. The released models are only allowed for non-commercial use.

Citation

If you find my paper or the codes useful in your research, please cite

@article{Wang2017NormFace,
Author = {Feng Wang and Xiang Xiang and Jian Cheng and Alan L. Yuille},
Title = {NormFace: L2 Hypersphere Embedding for Face Verification},
Year = {2017},
Eprint = {arXiv:1704.06369}
}

Contact

Feng Wang [feng.wff(at)gmail.com], please replace (at) with @.

About

NormFace: L2 HyperSphere Embedding for Face Verification, 99.21% on LFW

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • MATLAB 99.9%
  • Batchfile 0.1%