TransWikia.com

Similarity Measure between two feature vectors

Data Science Asked by Elbek on August 30, 2021

I have face identification system with following details:

  1. VGG16 model for feature extraction
  2. 512 dimensional feature vector (normalized)

I need to calculate similarity measure between two feature vectors. So far I have tried as difference measure:

  1. Pairwise cosine, euclidean distance
  2. Dot product (both vectors are normalize, so their dot product should be in range [-1, 1])

These methods are working fine when I want find closest feature vector from set of Feature Vectors. By sorting difference(distance) measure. But this method is relative measurement.

I want to have percentage of similarity. So I can say given image is Person XXX with degree of certainty of x percentage

Lets say that I have 2 feature vectors ( of person a and b).

I want to calculate accuracy level (in a percentage) that person a is
indeed person b, by probability of some percentage.

2 Answers

So, thank you for clarifying the question. Just to confirm that the question is asking how to set an appropriate threshold for face feature vectors (represented a a and b, for example).

What I would recommend is to look at either cosine similarity or euclidean distance, which you have implemented. From here, I would then look the distribution fo the similarity metric over all face vector pairings. Here, this can give you an idea of general level of similarity over all face vector pairings (e.g. if most of the distribution is skewed towards lowers facial similarities, then this could indicate overall lack of similarity between face vector pairings).

If the distribution is skewed to higher similarity values, then you could take, say, the 90th percentile over this distribution as the threshold for determining whether a == b.

Another idea would be to use the idea of softmax in the following way. This method would allow for others to replicate your methodology precisely:

For each face $f_i in F$, you compute the softmax over the face vector pairings between $f_i$ and $f_j in F, i neq j$. Then, from this, you select the index $j$ which has the highest value, which can then be assumed to be such that $f_i$ == $f_j$ (a == b)

Correct answer by shepan6 on August 30, 2021

So you want to identify a person via the similarity of the feature vector of the faces, with some database of known people, right?

The similarity measures you said will help you identify the person not evaluate the outcome of that identification. To do this you need a set of people, who you know (i.e. are labelled). Then you need to perform your methodology: extract features, measure similarity and identify that person. Then you need to compare this identification with their actual labels. Here is where you can evaluate your performance by measuring the accuracy, precision, recall, etc. of your identification system.

Answered by Djib2011 on August 30, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP