Spaces:
Sleeping
Sleeping
fixing preprocesing
Browse files
app.py
CHANGED
@@ -20,10 +20,10 @@ facenet.eval() # Set the model to evaluation mode
|
|
20 |
val_test_transform = transforms.Compose([
|
21 |
transforms.Resize((160, 160)), # FaceNet expects 160x160 input
|
22 |
transforms.ToTensor(),
|
23 |
-
transforms.Normalize(mean=[0.
|
24 |
])
|
25 |
|
26 |
-
def compare_faces(embedding1, embedding2, threshold=0.
|
27 |
dist = np.linalg.norm(embedding1 - embedding2)
|
28 |
return dist, dist < threshold
|
29 |
|
|
|
20 |
val_test_transform = transforms.Compose([
|
21 |
transforms.Resize((160, 160)), # FaceNet expects 160x160 input
|
22 |
transforms.ToTensor(),
|
23 |
+
transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])
|
24 |
])
|
25 |
|
26 |
+
def compare_faces(embedding1, embedding2, threshold=0.2): # Adjusted threshold
|
27 |
dist = np.linalg.norm(embedding1 - embedding2)
|
28 |
return dist, dist < threshold
|
29 |
|