facenet README

The project's README from github.com/davidsandberg/facenet. As one markdown file: README.md.

Face Recognition using Tensorflow Build Status

This is a TensorFlow implementation of the face recognizer described in the paper "FaceNet: A Unified Embedding for Face Recognition and Clustering". The project also uses ideas from the paper "Deep Face Recognition" from the Visual Geometry Group at Oxford.

Compatibility

The code is tested using Tensorflow r1.7 under Ubuntu 14.04 with Python 2.7 and Python 3.5. The test cases can be found here and the results can be found here.

News

Date Update
2018-04-10 Added new models trained on Casia-WebFace and VGGFace2 (see below). Note that the models uses fixed image standardization (see wiki).
2018-03-31 Added a new, more flexible input pipeline as well as a bunch of minor updates.
2017-05-13 Removed a bunch of older non-slim models. Moved the last bottleneck layer into the respective models. Corrected normalization of Center Loss.
2017-05-06 Added code to train a classifier on your own images. Renamed facenet_train.py to train_tripletloss.py and facenet_train_classifier.py to train_softmax.py.
2017-03-02 Added pretrained models that generate 128-dimensional embeddings.
2017-02-22 Updated to Tensorflow r1.0. Added Continuous Integration using Travis-CI.
2017-02-03 Added models where only trainable variables has been stored in the checkpoint. These are therefore significantly smaller.
2017-01-27 Added a model trained on a subset of the MS-Celeb-1M dataset. The LFW accuracy of this model is around 0.994.
2017‑01‑02 Updated to run with Tensorflow r0.12. Not sure if it runs with older versions of Tensorflow though.

Pre-trained models

Model name LFW accuracy Training dataset Architecture
20180408-102900 0.9905 CASIA-WebFace Inception ResNet v1
20180402-114759 0.9965 VGGFace2 Inception ResNet v1

NOTE: If you use any of the models, please do not forget to give proper credit to those providing the training dataset as well.

Inspiration

The code is heavily inspired by the OpenFace implementation.

Training data

The CASIA-WebFace dataset has been used for training. This training set consists of total of 453 453 images over 10 575 identities after face detection. Some performance improvement has been seen if the dataset has been filtered before training. Some more information about how this was done will come later. The best performing model has been trained on the VGGFace2 dataset consisting of ~3.3M faces and ~9000 classes.

Pre-processing

Face alignment using MTCNN

One problem with the above approach seems to be that the Dlib face detector misses some of the hard examples (partial occlusion, silhouettes, etc). This makes the training set too "easy" which causes the model to perform worse on other benchmarks. To solve this, other face landmark detectors has been tested. One face landmark detector that has proven to work very well in this setting is the Multi-task CNN. A Matlab/Caffe implementation can be found here and this has been used for face alignment with very good results. A Python/Tensorflow implementation of MTCNN can be found here. This implementation does not give identical results to the Matlab/Caffe implementation but the performance is very similar.

Running training

Currently, the best results are achieved by training the model using softmax loss. Details on how to train a model using softmax loss on the CASIA-WebFace dataset can be found on the page Classifier training of Inception-ResNet-v1 and .

Pre-trained models

Inception-ResNet-v1 model

A couple of pretrained models are provided. They are trained using softmax loss with the Inception-Resnet-v1 model. The datasets has been aligned using MTCNN.

Performance

The accuracy on LFW for the model 20180402-114759 is 0.99650+-0.00252. A description of how to run the test can be found on the page Validate on LFW. Note that the input images to the model need to be standardized using fixed image standardization (use the option --use_fixed_image_standardization when running e.g. validate_on_lfw.py).

facenet (davidsandberg/facenet)

Searching Database…

14.4K ·GitHub
这是什么?这是 FaceNet 的 TensorFlow 实现。FaceNet 是一个人脸识别系统,可以把人脸图片转换成 128 维的嵌入向量,用于识别和聚类,基于论文《FaceNet: A Unified Embedding for Face Recognition and Clustering》。
这是开箱即用的应用,还是需要我自己训练的研究代码?这是一个研究代码库:包含一组 Python 训练/验证脚本,以及可下载的预训练 Inception-ResNet-v1 模型,并不是打包好的应用程序。
要怎样才能让这个项目跑起来做人脸识别?下载其中一个预训练模型(例如 20180402-114759),使用随附的 MTCNN 实现对齐你的人脸数据集,然后对对齐后的图片运行验证或分类器脚本。
它需要哪些版本的 TensorFlow 和 Python?它是在 Ubuntu 14.04 上,使用 TensorFlow r1.7、Python 2.7 和 Python 3.5 测试的;不保证能在版本差别较大的更新或更旧的 TensorFlow 上运行。
预训练模型对任何输入图片都能直接用吗?不能。在把图片输入较新的模型之前,必须先用 MTCNN 对齐,并使用 --usefixedimagestandardization 选项做标准化,否则准确率会下降。
这个项目面向哪些人?面向想要研究或复现 FaceNet 类人脸嵌入模型的研究人员和工程师,而不是想找即插即用人脸识别应用的普通用户。
提供的预训练模型准确率如何?在 VGGFace2 上训练的 20180402-114759 模型在 LFW 基准测试上达到 0.9965 的准确率,CASIA-WebFace 模型达到 0.9905。
为什么人脸检测用 MTCNN 而不用 Dlib?Dlib 的检测器会漏掉部分遮挡等较难的样本,使训练变得过于简单,并影响泛化能力,所以作者改用 MTCNN,以获得更稳健的人脸对齐效果。
训练模型用了哪些数据集?使用了 CASIA-WebFace(约 453,453 张图片,10,575 个身份)和 VGGFace2(约 330 万张人脸,约 9,000 个类别),其中在 VGGFace2 上训练的模型表现最好。
我能用自己的人脸图片训练分类器吗?可以。仓库中包含相关脚本(最初是 facenet_train_classifier.py,现在是 train_softmax.py),可以利用预训练的嵌入向量,在自定义数据集上训练分类器。
Size
2.9 MB
Stars
14.4K
Updated
CommitApr 16
Age
10y
Commits · 90 Days