How Face Recognition Actually Works
Hi, I’m Vladimir, Faceter’s CTO. Today I would like to talk to you about the finer details of face recognition technology and how Faceter works. There are a lot of technical details ahead — don’t say we didn’t warn you!
Many people believe that deep neural networks recognise faces. Actually, that’s not quite right. A neural network allows you to extract a set of unique key features (facial features vector) from a face. Only then it is possible to identify/verify a person by comparing these key characteristics.
Usually, the key features are a set of N numbers (N = 32–2048 — in our case N = 128).
The problem is that although we said that facial features vector is unique to each person, in fact, the vectors extracted from one person’s different photos will be slightly different. Therefore, we cannot compare vectors element-wise.
A classic way of comparing two vectors is to obtain the Euclidean distance between them. Click on the link if you are interested in how it is actually calculated (https://hlab.stanford.edu/brian/euclidean_distance_in.html).
The lesser the distance between vectors is, the more similar the images will be. Therefore, to compare two people we will need to calculate the distance between their facial features vectors. If the distance is sufficiently small (less than a certain threshold), then we decide that it is the same person; if not, they must be different people.
Let’s imagine that we have a database of 1 million people (it means that we have 1 million facial features vectors), and we need to find the most similar face to a reference person’s face. In other words, we need to calculate 1 million vector distances between the reference person and the people in the database, and choose the smallest one. With such large volumes of data, this operation becomes quite resource intensive. Our R&D team wrote an implementation of the proximity search algorithm using the GPU, which shows very high performance — over 60 million comparisons per second. However, we are always searching for new ways to optimize our algorithms, and now we are examining an approach called DeepHash.
Using this approach, the neural network not only learns to extract facial vector features during the training process, but also learns to quantify the features of one person into a single unique hash that remains unique for every photo of this person. In this case, we can use the simplest hash comparison operation to compare facial hashes. This approach will create an incremental increase in the search/comparison performance of individuals.
If you are interested in such posts “from behind the scenes”, leave your feedback, likes and feel free to repost. From time to time, my colleagues and I will be happy to share our thoughts, experiences, and the latest updates with you.
Stay tuned!
Vladimir,
Faceter CTO