From c6300b53e0b5c29c97ec4fde1ce265bb95daae95 Mon Sep 17 00:00:00 2001 From: Uria Franko Date: Tue, 21 Apr 2020 16:24:47 +0300 Subject: [PATCH] Typo Mistake --- deepface/DeepFace.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/deepface/DeepFace.py b/deepface/DeepFace.py index 8fa2d51..503775a 100644 --- a/deepface/DeepFace.py +++ b/deepface/DeepFace.py @@ -207,7 +207,7 @@ def analyze(img_path, actions = [], models = {}): pbar = tqdm(range(0,len(actions)), desc='Finding actions') action_idx = 0 - img_244 = None # Set to prevent re-detection + img_224 = None # Set to prevent re-detection #for action in actions: for index in pbar: action = actions[index] @@ -240,20 +240,20 @@ def analyze(img_path, actions = [], models = {}): resp_obj += emotion_obj elif action == 'age': - if img_244 is None: - img_244 = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images + if img_224 is None: + img_224 = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images #print("age prediction") - age_predictions = age_model.predict(img_244)[0,:] + age_predictions = age_model.predict(img_224)[0,:] apparent_age = Age.findApparentAge(age_predictions) resp_obj += "\"age\": %s" % (apparent_age) elif action == 'gender': - if img_244 is None: - img_244 = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images + if img_224 is None: + img_224 = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images #print("gender prediction") - gender_prediction = gender_model.predict(img_244)[0,:] + gender_prediction = gender_model.predict(img_224)[0,:] if np.argmax(gender_prediction) == 0: gender = "Woman" @@ -263,9 +263,9 @@ def analyze(img_path, actions = [], models = {}): resp_obj += "\"gender\": \"%s\"" % (gender) elif action == 'race': - if img_244 is None: - img_244 = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images - race_predictions = race_model.predict(img_244)[0,:] + if img_224 is None: + img_224 = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images + race_predictions = race_model.predict(img_224)[0,:] race_labels = ['asian', 'indian', 'black', 'white', 'middle eastern', 'latino hispanic'] sum_of_predictions = race_predictions.sum()