From 67149c629b47a9ad26df57cbb9f48d2e736fa07c Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Tue, 15 Jun 2021 18:36:47 +0300 Subject: [PATCH] stream bug --- deepface/commons/realtime.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deepface/commons/realtime.py b/deepface/commons/realtime.py index 92da303..e120480 100644 --- a/deepface/commons/realtime.py +++ b/deepface/commons/realtime.py @@ -85,7 +85,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True employee = employees[index] pbar.set_description("Finding embedding for %s" % (employee.split("/")[-1])) embedding = [] - img = functions.preprocess_face(img = employee, target_size = (input_shape_y, input_shape_x), enforce_detection = False) + img = functions.preprocess_face(img = employee, target_size = (input_shape_y, input_shape_x), enforce_detection = False, detector_backend = 'opencv') img_representation = model.predict(img)[0,:] embedding.append(employee) @@ -196,7 +196,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True if enable_face_analysis == True: - gray_img = functions.preprocess_face(img = custom_face, target_size = (48, 48), grayscale = True, enforce_detection = False) + gray_img = functions.preprocess_face(img = custom_face, target_size = (48, 48), grayscale = True, enforce_detection = False, detector_backend = 'opencv') emotion_labels = ['Angry', 'Disgust', 'Fear', 'Happy', 'Sad', 'Surprise', 'Neutral'] emotion_predictions = emotion_model.predict(gray_img)[0,:] sum_of_predictions = emotion_predictions.sum() @@ -274,7 +274,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True #------------------------------- - face_224 = functions.preprocess_face(img = custom_face, target_size = (224, 224), grayscale = False, enforce_detection = False) + face_224 = functions.preprocess_face(img = custom_face, target_size = (224, 224), grayscale = False, enforce_detection = False, detector_backend = 'opencv') age_predictions = age_model.predict(face_224)[0,:] apparent_age = Age.findApparentAge(age_predictions) @@ -329,7 +329,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True #------------------------------- #face recognition - custom_face = functions.preprocess_face(img = custom_face, target_size = (input_shape_y, input_shape_x), enforce_detection = False) + custom_face = functions.preprocess_face(img = custom_face, target_size = (input_shape_y, input_shape_x), enforce_detection = False, detector_backend = 'opencv') #check preprocess_face function handled if custom_face.shape[1:3] == input_shape: