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

Commit

Permalink
feat: added check for if user already registered
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchellJC committed Oct 10, 2024
1 parent 6b05be7 commit 7436178
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion client/drivers/login_system.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@
from models.pose_detection.frame_capturer import RaspCapturer

NUM_FACES = 5
QUIT = -4
QUIT = -6
RESET = -5
BAD_STATUS_MESSAGES = {
Status.NO_FACES.value: "No face detected please",
Status.TOO_MANY_FACES.value: "Too many faces detected",
Status.NO_MATCH.value: "Could not match face",
Status.ALREADY_REGISTERED.value: "Face already registered",
}
QUIT_INSTRUCTIONS = "Right button to quit"

Expand Down
4 changes: 4 additions & 0 deletions client/models/face_recognition/recognition.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@


class Status(Enum):
ALREADY_REGISTERED = -4
NO_FACES = -3
TOO_MANY_FACES = -2
NO_MATCH = -1
Expand Down Expand Up @@ -77,6 +78,9 @@ def register_faces(user_id: int, faces: list[np.ndarray]) -> int:
for embedding in face_embeddings:
matches = face_recognition.compare_faces(other_user_embeddings, embedding)

if any(matches):
return Status.ALREADY_REGISTERED.value

register_face_embeddings(user_id, face_embeddings)

return Status.OK.value

0 comments on commit 7436178

Please sign in to comment.