All Projects → yule-li → Massface

yule-li / Massface

MassFace: an effecient implementation using triplet loss for face recognition

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Massface

Deepcamera
Open source face recognition on Raspberry Pi. SharpAI is open source stack for machine learning engineering with private deployment and AutoML for edge computing. DeepCamera is application of SharpAI designed for connecting computer vision model to surveillance camera. Developers can run same code on Raspberry Pi/Android/PC/AWS to boost your AI production development.
Stars: ✭ 757 (+1328.3%)
Mutual labels:  face-recognition
Training extensions
Trainable models and NN optimization tools
Stars: ✭ 857 (+1516.98%)
Mutual labels:  face-recognition
Facedataset
制作亚洲人脸数据集
Stars: ✭ 42 (-20.75%)
Mutual labels:  face-recognition
Face Recognition
Face Recognition Using Keras/tensorflow coupled with Node.js Server
Stars: ✭ 16 (-69.81%)
Mutual labels:  face-recognition
Facerec Lock
Face recognition to control servo lock using Raspberry Pi and OpenCV
Stars: ✭ 7 (-86.79%)
Mutual labels:  face-recognition
Compreface
Free and open-source face recognition system from Exadel
Stars: ✭ 947 (+1686.79%)
Mutual labels:  face-recognition
Facex Zoo
A PyTorch Toolbox for Face Recognition
Stars: ✭ 744 (+1303.77%)
Mutual labels:  face-recognition
Opencv Face Filters
Snapchat-like Face Filters in OpenCV
Stars: ✭ 51 (-3.77%)
Mutual labels:  face-recognition
Facerank
FaceRank - Rank Face by CNN Model based on TensorFlow (add keras version). FaceRank-人脸打分基于 TensorFlow (新增 Keras 版本) 的 CNN 模型(QQ群:167122861)。技术支持:http://tensorflow123.com
Stars: ✭ 841 (+1486.79%)
Mutual labels:  face-recognition
Smart Surveillance System Using Raspberry Pi
This is my Third Year Project for face recognition using OpenCV
Stars: ✭ 41 (-22.64%)
Mutual labels:  face-recognition
Helloface
An awesome face technology repository.
Stars: ✭ 905 (+1607.55%)
Mutual labels:  face-recognition
Inverse Style Gan
Looking up a generative latent vectors from (face) reference images.
Stars: ✭ 26 (-50.94%)
Mutual labels:  face-recognition
Facerecognition
OpenCV 3 & Keras implementation of face recognition for specific people.
Stars: ✭ 32 (-39.62%)
Mutual labels:  face-recognition
Facerecognition In Arkit
Detects faces using the Vision-API and runs the extracted face through a CoreML-model to identiy the specific persons.
Stars: ✭ 768 (+1349.06%)
Mutual labels:  face-recognition
Facial Expression Recognition.pytorch
A CNN based pytorch implementation on facial expression recognition (FER2013 and CK+), achieving 73.112% (state-of-the-art) in FER2013 and 94.64% in CK+ dataset
Stars: ✭ 1,013 (+1811.32%)
Mutual labels:  face-recognition
Human Detection And Tracking
Human-detection-and-Tracking
Stars: ✭ 753 (+1320.75%)
Mutual labels:  face-recognition
Object face detection webcam react
Face/Mood detection using face-api.js
Stars: ✭ 29 (-45.28%)
Mutual labels:  face-recognition
Facerecognition Gui App
A very Simple GUI APP for Face Detection and Recognition
Stars: ✭ 50 (-5.66%)
Mutual labels:  face-recognition
Face Identification With Cnn Triplet Loss
Face identification with cnn+triplet-loss written by Keras.
Stars: ✭ 45 (-15.09%)
Mutual labels:  face-recognition
Facerecog
Face Recognition using Neural Networks implemented using Keras
Stars: ✭ 39 (-26.42%)
Mutual labels:  face-recognition

MassFace: an effecient implementation using triplet loss for face recognition.

Recent Update

2019.09.27

  • Impoving triplet sample strategy: Assume identities list as class_indices
    • We iterate all person identities class_indices in an epoch. Then for each identity in a batch, we randomly sample its coresponding K images.
    • At the beginning of the epoch, we shuffle class_indices.
  • Triplet loss can be optimized togother with softmax loss: run bash train_triplet_with_softmax.sh

Features

  • This implementation supports multi-gpus.
  • The Data Sample is implemented by tf.data, which can load images fast in format of jpg, png.
  • The Triplet Selection is implemented by tf.py_func and it's flexible to modify as you need.
  • It's fast to train and the average time of one iteration with multi-gpus (210*4 images) is just about 0.6s in V100.
  • It achieves 98.3% accurace on LFW with softmax pretrain(97.1%).

Introduction

This project provide an efficient implementation for deep face recognition using Triplet Loss. When trained on CASIA-Webface and tested on on LFW,this code can achieve an 98.3% accuracy with softmax pretrain and 98.6% with CosFace pretrain. The framework using triplet loss can be seen as the following figure. It contrains Data Sample, Feature Extractor, Triplet Selection and Triplet Loss modules. The details can be seen as our technical report: MassFace: an effecient implementation using triplet loss for face recognition

image
Framework using triplet loss to train face recognition model: total P ∗ K images are sampled for P persons with K images each person. The sampled images are mapped into feature vectors through deep convolutional network. The indexs of triplet pairs are computed by a hard example mining process based on the feature vectors and the responding triplet feature pairs can be gathered. Finally, the features of triplet pairs are inputed into triplet loss to train the CNN.

Data Sample: we sample total P*K images for P persons with K images each in an iteration. We implement it by tensorflow tf.data api.

Feature Extractor: We use MobileFacenets [1] to extract the feature of the input image as a deep representation. It only has about 6.0MB parameters and can be infered very fast as well.

Triplet Selection: Triplet selection aims to choice the valid triplet (i, j, k) which is used as input of triplet loss. The valid triplet menas that i, j have the identity and i, k have different identity. We implement serveral mining strategy to select triplet pairs.

  • Batch All
  • Batch Random
  • Batch Min Min
  • Batch Min Max
  • Batch Hardest

Triplet Loss:

Mining methods:The triplet selection is based on a pool of the feature vectors. There are serveral methods to obtain the pool of feature vectors with size B.

  • Online
  • Offline
  • Semi-online

Installation

  • Install tensorflow 1.8: pip install tensorflow==1.8.0
  • Get code of this respository: git clone https://github.com/yule-li/MassFace.git

Data preprocessing

  • Align webface and lfw dataset to 112x112(casia-112x112,lfw-112x112) using insightface align method
  • If you want to train this code on your dataset, you just need to keep your dataset having the same directory like webface in which all images of the same identity located in one folder.

Train

  • Pretrain with softmax loss: run ./train_softmax.sh with argument NETWORK=mobilenet
  • Train with triplet loss: modify the PRETRAINED_MODEL to your pretrained model with softmax loss and run ./train_triplet.sh

Test

  • Modify MODEL_DIR in test.sh to your trained model
  • ./test.sh

Reference

  1. MoibleFaces
  2. MobileFaceNet_TF
  3. CosFace
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].
OSZAR »