Skip to content
This repository has been archived by the owner on Dec 8, 2024. It is now read-only.

feat: made registration more robust by checking images match #77

Merged
merged 1 commit into from
Oct 6, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions client/models/face_recognition/recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ def register_faces(user_id: int, faces: list[np.ndarray]) -> int:
face_embedding = all_faces_embed[0]
face_embeddings.append(face_embedding)

# Ensure that all images contain the same face
matches = face_recognition.compare_faces(face_embeddings[1:], face_embeddings[0])
if not all(matches):
return Status.TOO_MANY_FACES.value

register_face_embeddings(user_id, face_embeddings)

return Status.OK.value