This code helps in facial recognition using facenets (https://arxiv.org/pdf/1503.03832.pdf). The concept of facenets was originally presented in a research paper. The main concepts talked about triplet loss function to compare images of different person. This concept uses inception network which has been taken from source and fr_utils.py is taken from deeplearning.ai for reference. I have added several functionalities of my own for providing stability and better detection.
You can install Conda for python which resolves all the dependencies for machine learning.
pip install requirements.txt
A facial recognition system is a technology capable of identifying or verifying a person from a digital image or a video frame from a video source. There are multiples methods in which facial recognition systems work, but in general, they work by comparing selected facial features from given image with faces within a database.
- Detecting face only when your eyes are opened. (Security measure)
- Using face align functionality from dlib to predict effectively while live streaming.
- Network Used- Inception Network
- Original Paper - Facenet by Google
If you face any problem, kindly raise an issue
├── Facial-Recognition-using-Facenet (Current Directory)
├── models : Saved Models
├── face-rec_Google.h5 : Facenet Model
└── shape_predictor_68_face_landmarks.dat : Facial Keypoints Model
├── utils : Utils Folder
├── fr_utils.py
└── inception_blocks_v2.py
├── create_face.py : Store the faces for module
├── rec-feat.py - Main Application
├── Train-inception.py : Model Trainer
├── LICENSE
├── requirements.txt
└── readme.md
- If you want to train the network , run
Train-inception.py
, however you don't need to do that since I have already trained the model and saved it asface-rec_Google.h5
file which gets loaded at runtime. - Now you need to have images in your database. The code check
/images
folder for that. You can either paste your pictures there or you can click it using web cam. For doing that, runcreate-face.py
the images get stored in/incept
folder. You have to manually paste them in/images folder
- Run
rec-feat.py
for running the application.
python3 rec-feat.py
- Florian Schroff, Dmitry Kalenichenko, James Philbin (2015). FaceNet: A Unified Embedding for Face Recognition and Clustering
- Yaniv Taigman, Ming Yang, Marc'Aurelio Ranzato, Lior Wolf (2014). DeepFace: Closing the gap to human-level performance in face verification
- The pretrained model we use is inspired by Victor Sy Wang's implementation and was loaded using his code: https://github.com/iwantooxxoox/Keras-OpenFace.
- Our implementation also took a lot of inspiration from the official FaceNet github repository: https://github.com/davidsandberg/facenet