Skip to content

Commit 72484bd

Browse files
authored
demos/face_recognition: multiplying by 0.5 (#3950)
Ticket 137691
1 parent bfc67ae commit 72484bd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

demos/face_recognition_demo/python/faces_database.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ def __init__(self, label, descriptors):
3636

3737
@staticmethod
3838
def cosine_dist(x, y):
39+
# cosine() returns 1 - cosine_similarity. cosine_similarity
40+
# belongs to the interval
41+
# [-1, 1] (https://en.wikipedia.org/wiki/Cosine_similarity).
42+
# (1 - cosine_similarity) belongs to the interval [0, 2].
43+
# To provide a probability like interpretation of the
44+
# similarity measure, the interval is scaled down by the
45+
# factor of two.
3946
return cosine(x, y) * 0.5
4047

4148
def __init__(self, path, face_identifier, landmarks_detector, face_detector=None, no_show=False):

0 commit comments

Comments
 (0)