I am using the face_recognition python package to process images of people and detect the landmarks on their faces.
I actually want to create an ID for each user based on his/her face characteristics.
How can I uniquely identify a face using the landmarks? What makes 2 faces different or the same?
Is it the distance between their eyes, nose, lips, something about the chin? What is it unique in each one of us?
DeepFace wraps many facial recognition models such as FaceNet, VGG or ArcFace. These models basically represent faces as vectors. Then, vectors for same person should be more similar than the vectors for different persons. Here, the library uses euclidean and cosine to find the similarity between vectors. If the distance between those two vectors is less than a pre-tuned threshold value, then this pair is classified as same person. Here, you can find the pre-tuned threshold values for models and metric pairs.
If you want to find the vector embedding of a face, then you can use represent function of deepface. For instance, Facenet model generates 128 dimensional vectors.
from deepface import DeepFace
vector_embedding = DeepFace.represent("img.jpg", model_name = "Facenet")
assert isinstance(vector_embedding, list)
assert len(vector_embedding) == 128