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

Commit

Permalink
Merge pull request #61 from LimaoC/mitch-pi-ml-test
Browse files Browse the repository at this point in the history
Scripts for testing face rec and posture on rpi
  • Loading branch information
MitchellJC authored Sep 20, 2024
2 parents 584f7c2 + cf33f74 commit 9c9ddae
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
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()

0 comments on commit 9c9ddae

Please sign in to comment.