- Open up your console and clone repository locally.
- Install the library dependencies.
pip3 install -r requirements.txt
- Launch and test API via localhost:8000/docs
uvicorn main:app
- /model - retrieve information about the model
JSON response with pairs of identity_name:number of trained photos
- /model - deletes the pickle file containing the recognised faces
-
/predict - predicts the idenity of a face with preset euclidean distance of 0.6
JSON response with predicted idenity and euclidean distance. If greater than 0.6, identity will be "unknown" -
/authenticate - Takes in a name and optional threshold parameter and confirms the identity of a face
Will return either true or false -
/add - Adds faces to the system.
JSON response with the filenames of successfully added and rejected images
- Facial detection - YuNet
- Facial alignment - Dlib's 68 point face landmark predictor
- Facial encoding - Dlib's ResNet-34 inspired model
- Faces are first detected using the Yunet detector.
- Faces are then aligned and cropped by using the landmark predictor. This will keep faces consistent for better results
- Faces are then converted to 128 dimension vector encodings using Dlib's ResNet-34 recogniser.
- Faces can then be recognised by comparing thier 128-d vectors with each other. Images that have similar vectors (i.e. low euclidean distance) are considered to be of the same face.