Skip to content

A Keras implementation of MobileFaceNet from [MobileFaceNets: Efficient CNNs for Accurate Real-Time Face Verification on Mobile Devices](https://arxiv.org/abs/1804.07573).

License

Notifications You must be signed in to change notification settings

imagednn/MobileFaceNet-Keras

 
 

Repository files navigation

MobileFaceNet-Keras

A Keras implementation of MobileFaceNet from MobileFaceNets: Efficient CNNs for Accurate Real-Time Face Verification on Mobile Devices. It is the 1st time I uploaded my own work. If the license or citation is wrong, please inform me and I will change it ASAP.

1. Data Preprocessing Strategy

(1) Use the celebrity & msra datasets from the Trillion Pairs dataset: http://trillionpairs.deepglint.com/data.
(2) Set a standard face criterion to align the face & then crop the 112x112 area.
(3) For each identity folder:
a. n > 350
Randomly pick 350 pics from the origin data set
b. 200 < n <= 350
Keep all the pics
c. 90 < n <= 200
Keep all the pics & Apply Opening to them (Double the data)
d. 30 < n <= 90
Keep all the pics, Apply Opening to them, Add Gaussian noise to them & Add Salt & Pepper noise to them (Four times the data)
e. n <= 30
Drop the folder
(4) PS: The OpenCV ops in Python run really slow and all the operations above have a quite similar code implementation in C++. Thus it is recommended to use C++ for prerocessing the image dataset (OpenCV supports reading the Caffe version of MTCNN), as well as to use multi-thread processing.

2. Training Strategy

(1) Train the model with SoftMax loss for pre-training.
(2) After the loss becomes lingering around some value, change the loss to ArcFace loss and resume training.
The GPU memory is not enough for mini-batch size 512 (as did in the original paper) for training on a Nvidia 2080 Ti, thus I have to downsize it to 128 to fit in the memory.

3. Improvement for training step in progress.

The training data have been finished augmentation. There are 15,090,270 pics of 67,960 identities in the set and I choose 0.005 out of the data for validation during training. There might be something wrong with the implementation of the ArcFace loss and I am still trying to fix this.

References

(1) Original paper of MobileFaceNet: MobileFaceNet
(2) The idea of the implementation of model structure is from MobileNet v2: xiaochus/MobileNetV2
(3) The implementation of ArcFace loss (InsightFace loss) is from: ewrfcas/ArcFace_loss
(4) MTCNN library (the best MTCNN I've ever used): ipazc/mtcnn
(5) The idea of cropping face is from: deepinsight/insightface/face_preprocess

About

A Keras implementation of MobileFaceNet from [MobileFaceNets: Efficient CNNs for Accurate Real-Time Face Verification on Mobile Devices](https://arxiv.org/abs/1804.07573).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%