A lightweight face-recognition toolbox and pipeline based on tensorflow-lite with MTCNN-Face-Detection and ArcFace-Face-Recognition. No need to install complete tensorflow, tflite-runtime is enough. All tools are using CPU only.
Pull request are welcome!
- Online Face-Recognition
- Running completely on CPU
- Multi Faces
- ~4 FPS on a MacBookPro2015
- Tools for Face-Detection, -Verification and Identification
- GPU support
- Resolution-dependent model-selection
- Multithreading for multiple faces
- Fix bug installing with setup.py (not finding external url for tflite-runtime)
- OpenCV Window freezes on MacOS when quitting (seemed to be fixed)
Simply install the package via pip from git:
pip3 install git+https://github.com/martlgap/FaceIDLight
or if you do not have git installed on your system, install it directly from the wheel:
pip3 install https://github.com/Martlgap/FaceIDLight/releases/download/v.0.1/FaceIDLight-0.1-py3-none-any.whl
Clone the repository, init a virtual environment and install the requirements:
git clone https://github.com/Martlgap/FaceIDLight.git
cd FaceIDLight
python3.8 -m venv venv
pip3 install -r requirements.txt
If you have troubles to install tflite-runtime:
You can easily install tflite-runtime from https://google-coral.github.io/py-repo/ with the following line:
pip3 install tflite-runtime==2.5.0.post1 --find-links https://google-coral.github.io/py-repo/tflite-runtime
Run Python 3.8 and type in:
from FaceIDLight.demo import Demonstrator
Demonstrator().run()
You can select your own directory for gallery-images (*.png and *.jpg images are supported) by simply add
a keyword argument to the Demonstrator Class: Demonstrator(gal_dir=<full-path-to-your-gallery>)
You might change the webcam address ID. Do so via selecting a certain number for stream id:
Demonstrator(stream_id=<-1, 0, 1, 2, ...>)
Test the face-identification by simply holding a foto into camera. The provided sample_gallery includes images from: (Andrew_Caldecott, Anja_Paerson, Choi_Sung-hong, Elizabeth_Schumacher, Eva_Amurri, Jim_OBrien, Raul_Ibanez, Rubens_Barrichello, Takahiro_Mori)
Press "q" to close the Demo. (Window has to be selected)
This image shows an example of the Demonstrator()
:
- Thanks to Iván de Paz Centeno for his implementation of MTCNN in Tensorflow 2. The MTCNN model weights are taken "as is" from his repository and were converted to tflite-models afterwards.
- Thanks to Kuan-Yu Huang for his implementation of ArcFace in Tensorflow 2.
- We trained all provided models with the MS1M dataset.
If you use our trained models and want to cite our work feel free to use this: Image Resolution Susceptibility of Face Recognition Models
@inproceedings{Knoche2021ImageRS,
title={Image Resolution Susceptibility of Face Recognition Models},
author={Martin Knoche and Stefan Hormann and Gerhard Rigoll},
year={2021}
}