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

Scripts for testing face rec and posture on rpi #61

Merged
merged 2 commits into from
Sep 20, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 8 additions & 1 deletion scripts/async_posture.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
import logging
import pprint
import argparse

from models.pose_detection.routines import PostureProcess
from models.pose_detection.frame_capturer import RaspCapturer, OpenCVCapturer
from data.routines import destroy_database, init_database, create_user, get_postures

logger = logging.getLogger(__name__)


def main() -> None:
logging.basicConfig(level=logging.DEBUG)
parser = argparse.ArgumentParser()
parser.add_argument("-p", "--pi", action="store_true")
args = parser.parse_args()
logger.debug(args)

logger.debug("Testing PostureProces")
logger.debug("Destroying database")
destroy_database()
Expand All @@ -17,7 +24,7 @@ def main() -> None:
logger.debug("Inserting user")
user_id = create_user()
logger.debug("starting postures %s", get_postures())
process = PostureProcess()
process = PostureProcess(frame_capturer=RaspCapturer if args.pi else OpenCVCapturer)
for i in range(200):
logger.debug("Parent process running")

Expand Down
24 changes: 24 additions & 0 deletions scripts/test_face_match_pi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
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()