dlib is a machine learning library used to detect and recognize the faces
flask is a micro framework to create web page using python
Open cmd prompt, navigate to the directory
Create conda environment with necessary packages using environment.yml file
conda env create -f environment.yml
Activate the environment
conda activate ./environment
Run app.py
python app.py
Open localhost:5000 in the broswer
Face recognition can be done in following stages
- Face Detection
- Analyze Facial Feautures
- Compare against known faces
- Make a prediction
Face detection is done using Histogram of Oriented Gradients (HOG).In dlib shape_predictor_68_face_landmarks model can be used to get the 68 landmarks of the face.Related code can be found in face_landmark.py file
128 facial measurements (Face embeddings) are genereated by using a pretrained model dlib_face_recognition_resnet_model_v1. Deep learning is used to train the model based on the paper FaceNet
These 128 measurements can be used to recognize the face from previously known faces. A Classifier like SVM can also be trained on these facial embeddings
- dlib
conda install -c conda-forge dlib
- Flask
conda install Flask
- Scikit-image
conda install scikit-image