SCORING

JPPPPP
UCL-COMP0016–2020-Team13
3 min readFeb 24, 2021

As we are now able to locate the coordinates of key points of a person from the input image, we now need an algorithm that would measure the similarity between two pictures. We soon found out that using Cosine Similarity to measure the how similar two vectors are. For example, in the picture shown below, the lines within the rectangles are coming from the same part of the body. If two vectors are similar, the angle made by two vectors when they joined together needs to be small.

Basic Idea of Cosine Similarity

After we calculate all the vectors of each set of points that are connect to each other, we can easily measure cosine similarity between two vectors using a number of functions provided by numpy. We will then apply the algorithm to each set of vectors and calculate an average of all them to represent the cosine similarity of two input images[1].

x and y corresponds to two vectors that are numpy arrays

However, directly using the result from the function provided above to describe the similarity between two images is not suitable. The reason is that it still gives a relatively high result (from 0 to 1.0) even when two poses are completely different. As you can see, two poses are different from various way, but the algorithm still provides a high score which is 67.8%.

Therefore, we need to use a formula to enlarge the difference in similarity. We tried a number of combinations in order to have a reasonable result and we obtained a formula by experimentation. The formula we are now using is — — — — — 1/2 * (1-similarity)². It gives a reasonable result, but negative values would also occur.

Currently, we corrected the values that are below 10 to 10. We tested the algorithm and the formula to 8 groups of pictures and it gives a reasonable results. We will keep developing and testing to see if the formula needs to be improved.

[1]: 焦距 “余弦相似度及基于python的三种代码实现、与欧氏距离的区别” cnblog.com Point 2, 2018–03–01 [Online], Available: https://www.cnblogs.com/bymo/p/8489037.html [Accessed 2021–02–07]

--

--