Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.

cosine_distance in face_recognition_demo

anuragrawal
初學者
1,561 檢視

Hi,

 

Can someone explain to me the significance of multiplying by .5 in the cosine_distance() method here? : https://github.com/openvinotoolkit/open_model_zoo/blob/64fe6ef5c8ee769a97ed4d884ec3fbb8b6ca6477/demos/face_recognition_demo/python/faces_database.py#L38

 

I don't think it's accurate.

 

Thanks!

Anurag

0 積分
6 回應
Aznie_Intel
主席
1,527 檢視

 

Hi Anuargrawal,

 

Thanks for reaching out.

 We are checking this with our development team and will get back to you soon.

 

 

Regards,

Aznie


anuragrawal
初學者
1,491 檢視

@Aznie_Intel Do you have an update for me? Thanks!

Aznie_Intel
主席
1,425 檢視

Hi Anuargrawal,

 

We are checking this with our developer team, which may take some time. We will update you with the information once available.

 


Regards,

Aznie


anuragrawal
初學者
1,206 檢視

@Aznie_Intel, When can I expect an update on this?

Aznie_Intel
主席
1,168 檢視

Hi Anuragrawal,

 

Thanks for your patience. Here is the information from our developer team regarding the cosine value:

 

Multiplying by 0.5 is a part of the normalization process to scale the cosine distance value to a specific range. Typically, the cosine similarity ranges from -1 to 1, where 1 means identical vectors and -1 means completely opposite. By adding 1 and then multiplying by 0.5, the range is transformed to 0 to 1.

 

Without the multiplication by 0.5, the cosine similarity values will range from -1 to 1 (after adding 1 to the original cosine similarity). This means that a value of -1 indicates completely dissimilar vectors, a value of 0 indicates orthogonality (i.e., the vectors are unrelated), and a value of 1 indicates identical vectors. By multiplying by 0.5, the range is transformed to 0 to 1, which can be easier to interpret: a value closer to 0 indicates greater similarity, and a value closer to 1 indicates greater dissimilarity.

 

So, while you can certainly compute cosine similarity without the multiplication step, the interpretation of the results will be different. The choice to include this step often depends on the specific requirements of ones application and how you want to interpret the results.

 

I hope this is helpful to you.

 


Regards,

Aznie


Aznie_Intel
主席
1,021 檢視

Hi Anuragrawal,


This thread will no longer be monitored since we have provided information. If you need any additional information from Intel, please submit a new question.



Regards,

Aznie


回覆