mirror of
https://github.com/serengil/deepface.git
synced 2025-06-10 05:17:08 +00:00
stream bug fixed
This commit is contained in:
parent
0bd219d9c2
commit
a0c06a3792
@ -456,8 +456,8 @@ def preprocess_face(img, target_size=(224, 224), grayscale = False, enforce_dete
|
||||
|
||||
#we will align base image instead of detected face not have black pixels
|
||||
|
||||
img = align_face(img = img, detector_backend = detector_backend)
|
||||
img = detect_face(img = img, detector_backend = detector_backend, grayscale = grayscale, enforce_detection = False)
|
||||
img = detect_face(img = img, detector_backend = detector_backend, grayscale = grayscale, enforce_detection = enforce_detection)
|
||||
img = align_face(img = img, detector_backend = detector_backend)
|
||||
|
||||
#--------------------------
|
||||
|
||||
|
@ -112,7 +112,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(employee, (input_shape_y, input_shape_x))
|
||||
img = functions.preprocess_face(img = employee, target_size = (input_shape_y, input_shape_x), enforce_detection = False)
|
||||
img_representation = model.predict(img)[0,:]
|
||||
|
||||
embedding.append(employee)
|
||||
@ -222,7 +222,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True):
|
||||
|
||||
if enable_face_analysis == True:
|
||||
|
||||
gray_img = functions.preprocess_face(custom_face, (48, 48), True)
|
||||
gray_img = functions.preprocess_face(img = custom_face, target_size = (48, 48), grayscale = True, enforce_detection = False)
|
||||
emotion_labels = ['Angry', 'Disgust', 'Fear', 'Happy', 'Sad', 'Surprise', 'Neutral']
|
||||
emotion_predictions = emotion_model.predict(gray_img)[0,:]
|
||||
sum_of_predictions = emotion_predictions.sum()
|
||||
@ -300,7 +300,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True):
|
||||
|
||||
#-------------------------------
|
||||
|
||||
face_224 = functions.preprocess_face(custom_face, (224, 224), False)
|
||||
face_224 = functions.preprocess_face(img = custom_face, target_size = (224, 224), grayscale = False, enforce_detection = False)
|
||||
|
||||
age_predictions = age_model.predict(face_224)[0,:]
|
||||
apparent_age = Age.findApparentAge(age_predictions)
|
||||
@ -355,7 +355,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True):
|
||||
#-------------------------------
|
||||
#face recognition
|
||||
|
||||
custom_face = functions.preprocess_face(custom_face, (input_shape_y, input_shape_x))
|
||||
custom_face = functions.preprocess_face(img = custom_face, target_size = (input_shape_y, input_shape_x), enforce_detection = False)
|
||||
|
||||
#check preprocess_face function handled
|
||||
if custom_face.shape[1:3] == input_shape:
|
||||
|
Loading…
x
Reference in New Issue
Block a user