def main(args):
    if sys.version_info < (3, 0):
        print("Error: Python2 is slow. Use Python3 for max performance.")
        return

    cam_index = int(args.webcam)
    resolutions = [
        RESOLUTION_QVGA, RESOLUTION_VGA, RESOLUTION_HD, RESOLUTION_FULLHD
    ]
    try:
        cam_resolution = resolutions[int(args.resolution)]
    except:
        cam_resolution = RESOLUTION_QVGA

    if args.detector and args.encoder and args.speech_synthesizer:
        try:
            detector = FaceDetectorModels(int(args.detector))
            encoder = FaceEncoderModels(int(args.encoder))
            speech_synthesizer = SpeechSynthesizerModels(
                int(args.speech_synthesizer))
            print("Parameters: {} {} {}".format(detector, encoder,
                                                speech_synthesizer))
            process_facerecognition(detector, encoder, speech_synthesizer,
                                    cam_index, cam_resolution)
        except:
            print("Invalid parameter")
        return
    run(cam_index, cam_resolution)
Beispiel #2
0
def main(args):
    if args.detector and args.encoder:
        try:
            detector = FaceDetectorModels(int(args.detector))
            encoder = FaceEncoderModels(int(args.encoder))
            classifier = FaceClassifierModels(int(args.classifier))
            face_embeddings_path = args.face_embeddings_path
            print("Parameters: {} {} {} {}".format(detector, encoder,
                                                   classifier,
                                                   face_embeddings_path))

            train_recognition(detector, encoder, classifier,
                              face_embeddings_path, True)
            print("\nImage dataset training completed!")

            # generate audio samples for image datasets using text to speech synthesizer
            if args.set_speech_synthesizer:
                from libfaceid.speech_synthesizer import SpeechSynthesizerModels  # lazy loading
                speech_synthesizer = SpeechSynthesizerModels(
                    int(args.speech_synthesizer))
                #print( "Parameters: {}".format(speech_synthesizer) )
                train_audiosets(speech_synthesizer)
                print("Audio samples created!")
        except Exception as ex:
            print(ex)
            print("Invalid parameter")
        return
    run()