Skip to content

Commit

Permalink
error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
richmondu committed Jan 17, 2019
1 parent a0eeabf commit a89d97c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions libfaceid/liveness.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,14 @@ def __init__(self, path):
# https://github.com/ee09115/spoofing_detection
# https://www.idiap.ch/dataset/printattack
# https://www.idiap.ch/dataset/replayattack
self._clf_print = joblib.load(path + "colorspace_ycrcbluv_print.pkl")
self._clf_replay = joblib.load(path + "colorspace_ycrcbluv_replay.pkl")
try:
self._clf_print = joblib.load(path + "colorspace_ycrcbluv_print.pkl")
except Exception as e:
print("FaceLiveness_COLORSPACE_YCRCBLUV joblib exception {}".format(e))
try:
self._clf_replay = joblib.load(path + "colorspace_ycrcbluv_replay.pkl")
except:
print("FaceLiveness_COLORSPACE_YCRCBLUV joblib2 exception {}".format(e))

def is_fake(self, frame, face, flag=0):
feature_vector = self.get_embeddings(frame, face)
Expand Down
6 changes: 5 additions & 1 deletion libfaceid/speech_recognizer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,11 @@ class SpeechRecognizer_Common:
def __init__(self, model):
import speech_recognition # lazy loading
self._r = speech_recognition.Recognizer()
self._m = speech_recognition.Microphone()
try:
self._m = speech_recognition.Microphone()
except:
self._m = None
print("SpeechRecognizer_Common, no mic detected!")
self._model = SpeechRecognizerModels(model)

def start(self, words, user_callback):
Expand Down
2 changes: 1 addition & 1 deletion training.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def run():
train_recognition(detector, encoder, classifier, True)

# generate audio samples for image datasets using text to speech synthesizer
if False: # Set true to enable generation of audio for each person in datasets folder
if True: # Set true to enable generation of audio for each person in datasets folder
from libfaceid.speech_synthesizer import SpeechSynthesizerModels # lazy loading
speech_synthesizer = SpeechSynthesizerModels.TTSX3
#speech_synthesizer = SpeechSynthesizerModels.TACOTRON
Expand Down

0 comments on commit a89d97c

Please sign in to comment.