From c03300a5b9bcd824164e8145941b1e664e7096d4 Mon Sep 17 00:00:00 2001 From: richmondu Date: Fri, 25 Jan 2019 16:33:41 +0800 Subject: [PATCH] Cleanup --- agegenderemotion_webcam.bat | 4 ++-- agegenderemotion_webcam.py | 4 ++-- enrollment.py | 16 +++++++++++----- libfaceid/speech_synthesizer.py | 2 +- training.bat | 2 +- 5 files changed, 17 insertions(+), 11 deletions(-) diff --git a/agegenderemotion_webcam.bat b/agegenderemotion_webcam.bat index 7248d95..198cbed 100644 --- a/agegenderemotion_webcam.bat +++ b/agegenderemotion_webcam.bat @@ -2,9 +2,9 @@ :: camera resolution: 0-QVGA, 1-VGA, 2-HD, 3-FULLHD -python agegenderemotion_webcam.py -h +::python agegenderemotion_webcam.py -h -python agegenderemotion_webcam.py --detector 0 --webcam 0 --resolution 0 +python agegenderemotion_webcam.py --detector 4 --webcam 0 --resolution 0 pause diff --git a/agegenderemotion_webcam.py b/agegenderemotion_webcam.py index 73e7523..cc0f2d1 100644 --- a/agegenderemotion_webcam.py +++ b/agegenderemotion_webcam.py @@ -120,11 +120,11 @@ def process_facedetection(model_detector, model_poseestimator, model_ageestimato def run(cam_index, cam_resolution): - detector=FaceDetectorModels.HAARCASCADE +# detector=FaceDetectorModels.HAARCASCADE # detector=FaceDetectorModels.DLIBHOG # detector=FaceDetectorModels.DLIBCNN # detector=FaceDetectorModels.SSDRESNET -# detector=FaceDetectorModels.MTCNN + detector=FaceDetectorModels.MTCNN # detector=FaceDetectorModels.FACENET encoder=FaceEncoderModels.LBPH diff --git a/enrollment.py b/enrollment.py index 958b578..422f6cb 100644 --- a/enrollment.py +++ b/enrollment.py @@ -5,6 +5,7 @@ import os import datetime import math +import imutils from libfaceid.detector import FaceDetectorModels, FaceDetector from libfaceid.encoder import FaceEncoderModels, FaceEncoder from libfaceid.classifier import FaceClassifierModels @@ -109,7 +110,8 @@ def process_faceenrollment(model_detector, cam_index, cam_resolution): saveVideo = False out = None color_recording = (255,255,255) - + is_windows = (os.name == 'nt') + while (True): @@ -143,6 +145,8 @@ def process_faceenrollment(model_detector, cam_index, cam_resolution): cv2.line(fg, (s1[i,0], s1[i,1]), (s2[i,0], s2[i,1]), (0, 0, 0), 2, cv2.LINE_AA) # Display updated frame + if is_windows: + fg = imutils.resize(fg, height=480) cv2.imshow(WINDOW_NAME, fg) # Check for user actions @@ -216,8 +220,9 @@ def run(cam_index, cam_resolution, name): print("") print("Processing of video recording started...") - video_to_images(detector, "x" + INPUT_DIR_DATASET, name) - video_to_images(detector, INPUT_DIR_DATASET, name, one_image_only=True) +# video_to_images(detector, "x" + INPUT_DIR_DATASET, name) +# video_to_images(detector, INPUT_DIR_DATASET, name, one_image_only=True) + video_to_images(detector, INPUT_DIR_DATASET, name) print("Processing of video recording completed!") print("Make sure to train the new datasets before testing!") print("") @@ -245,8 +250,9 @@ def main(args): print("") print("Processing of video recording started...") - video_to_images(detector, "x" + INPUT_DIR_DATASET, name) - video_to_images(detector, INPUT_DIR_DATASET, name, one_image_only=True) + #video_to_images(detector, "x" + INPUT_DIR_DATASET, name) + #video_to_images(detector, INPUT_DIR_DATASET, name, one_image_only=True) + video_to_images(detector, INPUT_DIR_DATASET, name) print("Processing of video recording completed!") print("Make sure to train the new datasets before testing!") print("") diff --git a/libfaceid/speech_synthesizer.py b/libfaceid/speech_synthesizer.py index d74143c..850f765 100644 --- a/libfaceid/speech_synthesizer.py +++ b/libfaceid/speech_synthesizer.py @@ -46,7 +46,7 @@ def synthesize_datasets(self, path_datasets): def playaudio(self, path, name, block=True): try: - if (name is not None) and (name != "Unknown"): + if (name is not None) and (name != "Unknown") and (name != "Fake"): self._base.playaudio(path, name, block) except: print("SpeechSynthesizer playaudio EXCEPTION") diff --git a/training.bat b/training.bat index 516656d..21f7048 100644 --- a/training.bat +++ b/training.bat @@ -5,5 +5,5 @@ python training.py -h ::python training.py --detector 0 --encoder 0 --classifier 0 -python training.py --detector 4 --encoder 0 --classifier 0 --set_speech_synthesizer True --speech_synthesizer 0 +python training.py --detector 4 --encoder 1 --classifier 1 --set_speech_synthesizer True --speech_synthesizer 0 pause