Commit 1d3f1d50 authored by Kyle Anderson's avatar Kyle Anderson

Fix common and authenticate for interface

Realized that there were some problems with the authentication and common modules, so fixed them here.
parent 9a8ba48e
......@@ -23,7 +23,7 @@ def load_encodings(file_location: str):
return data_handler.load_database(file_location)
def determine_identity(face_encoding, known_faces):
def determine_identity(face_encoding, known_faces) -> str:
"""
"Determines the most likely identity of a single face. Returns the user id.
:param face_encoding: The encoding which needs identification.
......@@ -36,8 +36,10 @@ def determine_identity(face_encoding, known_faces):
# Count the number of occurrences of true.
recognized_users[user_id] = matches.count(True)
matched_user: str = max(recognized_users,
key=recognized_users.get)
matched_user = ""
if len(recognized_users) > 0:
matched_user: str = max(recognized_users,
key=recognized_users.get)
return matched_user
......
......@@ -6,7 +6,7 @@ DATA_DIR = "data"
DATASET_DIR = "dataset"
DATABASE_LOC = os.path.join(DATA_DIR, "database.pickle")
RES_DIRECTORY = "./res"
RES_DIRECTORY = "res"
# Directory for the face detection model.
FACE_DETECTION_MODEL_DIR = os.path.join(RES_DIRECTORY, "face_detection_model")
EMBEDDINGS_PROCESSOR_LOC = os.path.join(RES_DIRECTORY, "openface_nn4.small2.v1.t7")
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment