How Euclidean distance algorithm calculate two different face images are match or not match in face recognition? [closed]

I am trying to make a face login application. face comparison algorithm is using Euclidean distance to calculate two different face images that are the same or not the same. can anyone help me with how the Euclidean distance algorithm is working?

• Euclidean distance is the vector distance - en.wikipedia.org/wiki/Euclidean_distance - e.g. $\sqrt{\sum_i (x_i - y_i)^2}$. This seems a bit simple for a question though if you are doing face recognition work . . . could you explain more about where you are stuck – Neil Slater Nov 25 '19 at 10:30
• Welcome to SE:AI! This question has been flagged for clarification. (Closed provisionally pending revision.) – DukeZhou Nov 26 '19 at 19:55

1 Answer

Simply put, Euclidean distance measures how far away two items are (see Neil Slater's comment).

In order to apply this to a pattern recognition task, you will need to convert the items to compare (in your case images of faces) into feature vectors (ie lists of numerical values), and then you do a pairwise comparison to work out how distant two faces are. You will then need to set a threshold where you treat two images as being the same face (typically where the distance between the feature vectors is small).

Selecting the right features is obviously crucial here. I'm not an expert on face descriptions, but it would probably be something like

• the distance between the eyes
• the distance between the bottom of the nose and the top of the upper lip
• ...

Once you have these measurements, store the values for each image in a vector and you can apply the Euclidean distance. Effectively, each image is represented as a point in the $$m$$-dimensional feature space, where each measurement is a dimension. To select good features make sure they are not correlated (ie they are independent of each other) and are the same scale (eg all are distances, so not eye colour)

The choice of Euclidean distance is fairly minor: there are other distance metrics which might work equally well or even better. As I mentioned, the key point is selecting appropriate feature values.

• You are describing "old school" biometric feature embeddings. Typical modern systems will learn more automated vector representation. Most importantly these can be trained without requiring labels with all the biometrics from thousands of faces. Instead to learn a feature vector they just need to know the true identity of person plus have multiple images of same person (at least 2 for each person, but more can be better). Otherwise the Euclidean distance part is the same – Neil Slater Nov 25 '19 at 14:07
• @NeilSlater Yes, you are right; but for a simple project (which I assume the OP is talking about) it's easier to do it that way. – Oliver Mason Nov 25 '19 at 14:22