Spaces:
Runtime error
Runtime error
Update helpers.py
Browse files- helpers.py +6 -0
helpers.py
CHANGED
@@ -76,6 +76,12 @@ def load_model(
|
|
76 |
|
77 |
return deepface_model
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
def get_embeddings(model, imgs):
|
80 |
embeddings = []
|
81 |
for img in imgs:
|
|
|
76 |
|
77 |
return deepface_model
|
78 |
|
79 |
+
def findCosineDistance(source_representation, test_representation):
|
80 |
+
a = np.matmul(np.transpose(source_representation), test_representation)
|
81 |
+
b = np.sum(np.multiply(source_representation, source_representation))
|
82 |
+
c = np.sum(np.multiply(test_representation, test_representation))
|
83 |
+
return 1 - (a / (np.sqrt(b) * np.sqrt(c)))
|
84 |
+
|
85 |
def get_embeddings(model, imgs):
|
86 |
embeddings = []
|
87 |
for img in imgs:
|