Spaces:
Sleeping
Sleeping
change model recognition
Browse files- .gitattributes +1 -0
- app.py +5 -5
- faceNet_update_transformation.pth +3 -0
.gitattributes
CHANGED
@@ -35,3 +35,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
faceViT4.pth filter=lfs diff=lfs merge=lfs -text
|
37 |
faceNet6.pth filter=lfs diff=lfs merge=lfs -text
|
|
|
|
35 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
36 |
faceViT4.pth filter=lfs diff=lfs merge=lfs -text
|
37 |
faceNet6.pth filter=lfs diff=lfs merge=lfs -text
|
38 |
+
faceNet_update_transformation.pth filter=lfs diff=lfs merge=lfs -text
|
app.py
CHANGED
@@ -11,7 +11,7 @@ mtcnn = MTCNN(keep_all=True, device='cuda' if torch.cuda.is_available() else 'cp
|
|
11 |
|
12 |
# Load the pre-trained FaceNet model
|
13 |
facenet = InceptionResnetV1(pretrained='vggface2').eval().to('cuda' if torch.cuda.is_available() else 'cpu')
|
14 |
-
model_path = r'
|
15 |
model_state_dict = torch.load(model_path)
|
16 |
facenet.load_state_dict(model_state_dict)
|
17 |
facenet.eval() # Set the model to evaluation mode
|
@@ -72,10 +72,10 @@ def process_images(image1, image2):
|
|
72 |
embedding1 = l2_normalize(embedding1)
|
73 |
embedding2 = l2_normalize(embedding2)
|
74 |
|
75 |
-
distance, is_match = compare_faces(embedding1, embedding2, threshold=0.
|
76 |
|
77 |
-
# Calculate confidence
|
78 |
-
confidence = max(0.0, 1.0 - distance / 1.0) # Ensure confidence is between 0 and 1
|
79 |
|
80 |
end_time = time.time()
|
81 |
inference_time = end_time - start_time
|
@@ -84,7 +84,7 @@ def process_images(image1, image2):
|
|
84 |
image1_with_box = draw_bounding_box(image1, box1)
|
85 |
image2_with_box = draw_bounding_box(image2, box2)
|
86 |
|
87 |
-
result = f"Distance: {distance:.2f}\nMatch: {is_match}\
|
88 |
|
89 |
return [image1_with_box, image2_with_box], result
|
90 |
|
|
|
11 |
|
12 |
# Load the pre-trained FaceNet model
|
13 |
facenet = InceptionResnetV1(pretrained='vggface2').eval().to('cuda' if torch.cuda.is_available() else 'cpu')
|
14 |
+
model_path = r'faceNet_update_transformation.pth'
|
15 |
model_state_dict = torch.load(model_path)
|
16 |
facenet.load_state_dict(model_state_dict)
|
17 |
facenet.eval() # Set the model to evaluation mode
|
|
|
72 |
embedding1 = l2_normalize(embedding1)
|
73 |
embedding2 = l2_normalize(embedding2)
|
74 |
|
75 |
+
distance, is_match = compare_faces(embedding1, embedding2, threshold=0.25)
|
76 |
|
77 |
+
# # Calculate confidence
|
78 |
+
# confidence = max(0.0, 1.0 - distance / 1.0) # Ensure confidence is between 0 and 1
|
79 |
|
80 |
end_time = time.time()
|
81 |
inference_time = end_time - start_time
|
|
|
84 |
image1_with_box = draw_bounding_box(image1, box1)
|
85 |
image2_with_box = draw_bounding_box(image2, box2)
|
86 |
|
87 |
+
result = f"Distance: {distance:.2f}\nMatch: {is_match}\nInference time: {inference_time:.2f} seconds"
|
88 |
|
89 |
return [image1_with_box, image2_with_box], result
|
90 |
|
faceNet_update_transformation.pth
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:86b4b567798373e423655892a9a377038d2cfae87bbb073d3d9ae83b93a94081
|
3 |
+
size 112028666
|