stream bug

This commit is contained in:
Sefik Ilkin Serengil 2021-06-15 18:36:47 +03:00
parent d6baa8381c
commit 67149c629b

View File

@ -85,7 +85,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True
employee = employees[index] employee = employees[index]
pbar.set_description("Finding embedding for %s" % (employee.split("/")[-1])) pbar.set_description("Finding embedding for %s" % (employee.split("/")[-1]))
embedding = [] 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,:] img_representation = model.predict(img)[0,:]
embedding.append(employee) embedding.append(employee)
@ -196,7 +196,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True
if 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_labels = ['Angry', 'Disgust', 'Fear', 'Happy', 'Sad', 'Surprise', 'Neutral']
emotion_predictions = emotion_model.predict(gray_img)[0,:] emotion_predictions = emotion_model.predict(gray_img)[0,:]
sum_of_predictions = emotion_predictions.sum() 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,:] age_predictions = age_model.predict(face_224)[0,:]
apparent_age = Age.findApparentAge(age_predictions) apparent_age = Age.findApparentAge(age_predictions)
@ -329,7 +329,7 @@ def analysis(db_path, model_name, distance_metric, enable_face_analysis = True
#------------------------------- #-------------------------------
#face recognition #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 #check preprocess_face function handled
if custom_face.shape[1:3] == input_shape: if custom_face.shape[1:3] == input_shape: