Masked Face Recognition using MTCNN and FaceNet
Requires Python>=3.8 Required Packages
- opencv-python
- scikit-learn
- torch
- imutils
- facenet-pytorch
- matplotlib
- numpy
The required packages can be installed using requirements.txt
pip install -r requirements.txt
MTCNN paper link.
For detecting face and landmarks in MTCNN
python mtcnn.py <path_to_img>
Example outputs
Use the following command to align faces properly based on eye-landmarks
python mtcnn.py <path_to_img> --align
Example outputs
Facenet paper link. It is better to go through the paper to get more understanding on architecture and the loss function is used.
The Facenet model can be used with pretrained weights. For testing purposes this repository used RMFRD dataset which can be downloaded here.
Import the face_recognition_model into your python file and create a FaceRecognizer object. add_face can be called to add some reference images of a person with a label. The predict function can then be called to recognize the face on new data.