Face recognition is one of the features in computer vision that has gained popularity recently. Being able to identify a person in the photo and video, we can not miss the understanding of face embedding. In this post, I’ll cover all the basic things you need to know about face embedding.
What is face embedding
Face embedding is the way a machine stores a face from the feature extraction into a vector array. Normally, this kind of vector array has lengths of 128, 512, etc. The most popular case so far is 128. This vector array will be used to compare with another face by distance, similarity, or face search.
Distance and Similarity
Face distance is the matrix that we can use to compare the different between two faces. From that distance, we can decide whether both faces are matched.
Euclidean distance
Euclidean distance is the most popular distance metric measurement in face match to calculate the distance between 2 vectors.
To calculate the euclidean distance between vector a and vector b with numpy
distance = np.linalg.norm(a - b)
Cosine similarity
Cosine similarity is a similarity metric to measure the angle between 2 vectors
To calculate cosine similarity between vector a and vector b with numpy
similarity = np.dot(a, b) / (np.linalg.norm(a) * np.linalg.norm(b))
Use Case
- Biometric Authentication: Face embedding has been using face matched or face authentication.
- Identify a person in video or photo: The storing of face vectors has been used for face searches to match people in computer vision
Conclusion
Understand face embedding is the key point in face recognition. We can use both distance above to apply threshold in order to consider 2 faces are matched.