Spaces:
Runtime error
Runtime error
Testing
Browse files
app.py
CHANGED
@@ -109,8 +109,8 @@ def compare_face():
|
|
109 |
feature32_1 = feature32_1 / np.linalg.norm(feature32_1)
|
110 |
feature32_2 = feature2.view(dtype=np.float32)
|
111 |
feature32_2 = feature32_2 / np.linalg.norm(feature32_2)
|
112 |
-
|
113 |
-
feature32 = np.frombuffer(feature1, dtype=np.float32, count=512)
|
114 |
|
115 |
similarity = ttv_compare_feature(feature1, feature2)
|
116 |
if similarity > 0.7:
|
@@ -127,6 +127,7 @@ def compare_face():
|
|
127 |
"similarity": float(similarity),
|
128 |
"face1": {"x1": int(faceRect1[0]), "y1": int(faceRect1[1]), "x2": int(faceRect1[2]), "y2" : int(faceRect1[3])},
|
129 |
"face2": {"x1": int(faceRect2[0]), "y1": int(faceRect2[1]), "x2": int(faceRect2[2]), "y2" : int(faceRect2[3])},
|
|
|
130 |
}
|
131 |
})
|
132 |
|
|
|
109 |
feature32_1 = feature32_1 / np.linalg.norm(feature32_1)
|
110 |
feature32_2 = feature2.view(dtype=np.float32)
|
111 |
feature32_2 = feature32_2 / np.linalg.norm(feature32_2)
|
112 |
+
sim_2 = 1 + np.dot(feature32_1, feature32_2)
|
113 |
+
# feature32 = np.frombuffer(feature1, dtype=np.float32, count=512)
|
114 |
|
115 |
similarity = ttv_compare_feature(feature1, feature2)
|
116 |
if similarity > 0.7:
|
|
|
127 |
"similarity": float(similarity),
|
128 |
"face1": {"x1": int(faceRect1[0]), "y1": int(faceRect1[1]), "x2": int(faceRect1[2]), "y2" : int(faceRect1[3])},
|
129 |
"face2": {"x1": int(faceRect2[0]), "y1": int(faceRect2[1]), "x2": int(faceRect2[2]), "y2" : int(faceRect2[3])},
|
130 |
+
"sim_2": float(sim_2)
|
131 |
}
|
132 |
})
|
133 |
|