Spaces:
Runtime error
Runtime error
Testing
Browse files
app.py
CHANGED
@@ -105,6 +105,12 @@ def compare_face():
|
|
105 |
response.headers["Content-Type"] = "application/json; charset=utf-8"
|
106 |
return response
|
107 |
|
|
|
|
|
|
|
|
|
|
|
|
|
108 |
similarity = ttv_compare_feature(feature1, feature2)
|
109 |
if similarity > 0.7:
|
110 |
result = "same"
|
@@ -191,13 +197,6 @@ def coompare_face_base64():
|
|
191 |
response.headers["Content-Type"] = "application/json; charset=utf-8"
|
192 |
return response
|
193 |
|
194 |
-
feature32_1 = feature1.view(dtype=np.float32)
|
195 |
-
feature32_2 = feature2.view(dtype=np.float32)
|
196 |
-
sim_1 = np.dot(feature32_1, feature32_2)
|
197 |
-
feature32 = np.frombuffer(feature1, dtype=np.float32, count=512)
|
198 |
-
feature322 = np.frombuffer(feature1, dtype=np.float32, count=512)
|
199 |
-
sim_2 = np.dot(feature32, feature322)
|
200 |
-
|
201 |
similarity = ttv_compare_feature(feature1, feature2)
|
202 |
if similarity > 0.7:
|
203 |
result = "same"
|
@@ -213,8 +212,6 @@ def coompare_face_base64():
|
|
213 |
"similarity": float(similarity),
|
214 |
"face1": {"x1": int(faceRect1[0]), "y1": int(faceRect1[1]), "x2": int(faceRect1[2]), "y2" : int(faceRect1[3])},
|
215 |
"face2": {"x1": int(faceRect2[0]), "y1": int(faceRect2[1]), "x2": int(faceRect2[2]), "y2" : int(faceRect2[3])},
|
216 |
-
"sim_1": float(sim_1),
|
217 |
-
"sim_2": float(sim_2),
|
218 |
}
|
219 |
})
|
220 |
response.status_code = 200
|
|
|
105 |
response.headers["Content-Type"] = "application/json; charset=utf-8"
|
106 |
return response
|
107 |
|
108 |
+
feature32_1 = feature1.view(dtype=np.float32)
|
109 |
+
print(feature32_1)
|
110 |
+
print('===========================')
|
111 |
+
feature32 = np.frombuffer(feature1, dtype=np.float32, count=512)
|
112 |
+
print(feature32)
|
113 |
+
|
114 |
similarity = ttv_compare_feature(feature1, feature2)
|
115 |
if similarity > 0.7:
|
116 |
result = "same"
|
|
|
197 |
response.headers["Content-Type"] = "application/json; charset=utf-8"
|
198 |
return response
|
199 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
200 |
similarity = ttv_compare_feature(feature1, feature2)
|
201 |
if similarity > 0.7:
|
202 |
result = "same"
|
|
|
212 |
"similarity": float(similarity),
|
213 |
"face1": {"x1": int(faceRect1[0]), "y1": int(faceRect1[1]), "x2": int(faceRect1[2]), "y2" : int(faceRect1[3])},
|
214 |
"face2": {"x1": int(faceRect2[0]), "y1": int(faceRect2[1]), "x2": int(faceRect2[2]), "y2" : int(faceRect2[3])},
|
|
|
|
|
215 |
}
|
216 |
})
|
217 |
response.status_code = 200
|