From b6f96cc68b91a86fd38a41b01ccc36c93de7eb29 Mon Sep 17 00:00:00 2001 From: Mitchell Clark Date: Wed, 2 Oct 2024 11:18:04 +1000 Subject: [PATCH 1/2] ref: deleted old test scripts as these are captured by face_unlock.py now --- scripts/register_faces.py | 25 ------------------------- scripts/test_face_match_pi.py | 24 ------------------------ 2 files changed, 49 deletions(-) delete mode 100644 scripts/register_faces.py delete mode 100644 scripts/test_face_match_pi.py diff --git a/scripts/register_faces.py b/scripts/register_faces.py deleted file mode 100644 index f6d9fb4..0000000 --- a/scripts/register_faces.py +++ /dev/null @@ -1,25 +0,0 @@ -import logging - -import cv2 -from data.routines import register_faces - -logger = logging.getLogger(__name__) - - -def main(): - logging.basicConfig(level=logging.DEBUG) - - video = cv2.VideoCapture(0) - faces = [] - for _ in range(5): - _, frame = video.read() - faces.append(frame) - input("Enter to continue: ") - - video.release() - logger.debug("Registering faces") - register_faces(1, faces) - - -if __name__ == "__main__": - main() diff --git a/scripts/test_face_match_pi.py b/scripts/test_face_match_pi.py deleted file mode 100644 index 3cb274b..0000000 --- a/scripts/test_face_match_pi.py +++ /dev/null @@ -1,24 +0,0 @@ -import argparse -import logging - -import cv2 - -from models.face_recognition.recognition import get_face_match - -logger = logging.getLogger(__name__) - - -def main(): - parser = argparse.ArgumentParser() - parser.add_argument("image_path") - args = parser.parse_args() - logger.debug("Reading image") - face = cv2.imread(args.image_path) - logger.debug("Checking for a match") - matched_id = get_face_match(face) - - logger.debug("Matched user %d", matched_id) - - -if __name__ == "__main__": - main() From 0f91a6ec664ca1fd0981f3d10fa974863f79d700 Mon Sep 17 00:00:00 2001 From: Mitchell Clark Date: Wed, 2 Oct 2024 11:23:34 +1000 Subject: [PATCH 2/2] ref: removed explore-deepface script --- scripts/explore-deepface.py | 35 ----------------------------------- 1 file changed, 35 deletions(-) delete mode 100644 scripts/explore-deepface.py diff --git a/scripts/explore-deepface.py b/scripts/explore-deepface.py deleted file mode 100644 index 2969f64..0000000 --- a/scripts/explore-deepface.py +++ /dev/null @@ -1,35 +0,0 @@ -from pprint import pprint -import cv2 -from deepface import DeepFace - - -ENTER_ASCII = 13 - - -def take_photo(photo_name): - capture = cv2.VideoCapture(0) - while True: - success, frame = capture.read() - if not success: - continue - - cv2.imshow(f"Camera Preview for {photo_name}: Press enter to take photo", frame) - - if cv2.waitKey(1) & 0xFF == ENTER_ASCII: - cv2.imwrite(photo_name, frame) - - break - - capture.release() - cv2.destroyAllWindows() - - -# Take two photos. Press enter to confirm photo. -print("Please take two photos") -take_photo("photo1.png") -take_photo("photo2.png") - - -# Verify that photos are of same person. -print("Deepface output") -pprint(DeepFace.verify("photo1.png", "photo2.png", model_name="GhostFaceNet"))