Spaces:
Sleeping
Sleeping
modify threshold
Browse files
app.py
CHANGED
@@ -38,7 +38,7 @@ model.load_state_dict(torch.load(model_path))
|
|
38 |
|
39 |
|
40 |
# Initialize MTCNN for face detection
|
41 |
-
mtcnn = MTCNN(keep_all=True, min_face_size=12,device=device)
|
42 |
|
43 |
def align_face(frame):
|
44 |
# Convert the frame to a PIL image if it's a numpy array
|
@@ -87,7 +87,7 @@ def process_images(image1, image2):
|
|
87 |
embedding2 = embedding2.flatten()
|
88 |
|
89 |
euclidean_dist = euclidean_distance(embedding1, embedding2)
|
90 |
-
is_match = euclidean_dist < 0.
|
91 |
|
92 |
# Calculate confidence
|
93 |
confidence = max(0.0, 1.0 - euclidean_dist / 1.0) # Ensure confidence is between 0 and 1
|
|
|
38 |
|
39 |
|
40 |
# Initialize MTCNN for face detection
|
41 |
+
mtcnn = MTCNN(keep_all=True, post_process=False, min_face_size=12, device=device)
|
42 |
|
43 |
def align_face(frame):
|
44 |
# Convert the frame to a PIL image if it's a numpy array
|
|
|
87 |
embedding2 = embedding2.flatten()
|
88 |
|
89 |
euclidean_dist = euclidean_distance(embedding1, embedding2)
|
90 |
+
is_match = euclidean_dist < 0.3
|
91 |
|
92 |
# Calculate confidence
|
93 |
confidence = max(0.0, 1.0 - euclidean_dist / 1.0) # Ensure confidence is between 0 and 1
|