mirror of
https://github.com/serengil/deepface.git
synced 2025-06-05 19:15:23 +00:00
calling analysis without param bug
This commit is contained in:
parent
539198737a
commit
b7ed1897f5
@ -122,8 +122,6 @@ def analyze(img_path, actions= []):
|
||||
|
||||
print("Actions to do: ", actions)
|
||||
|
||||
img = functions.detectFace(img_path, (224, 224))
|
||||
|
||||
#TO-DO: do this in parallel
|
||||
|
||||
pbar = tqdm(range(0,len(actions)), desc='Finding actions')
|
||||
@ -163,6 +161,7 @@ def analyze(img_path, actions= []):
|
||||
resp_obj += emotion_obj
|
||||
|
||||
elif action == 'age':
|
||||
img = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images
|
||||
#print("age prediction")
|
||||
model = Age.loadModel()
|
||||
age_predictions = model.predict(img)[0,:]
|
||||
@ -171,6 +170,7 @@ def analyze(img_path, actions= []):
|
||||
resp_obj += "\"age\": %s" % (apparent_age)
|
||||
|
||||
elif action == 'gender':
|
||||
img = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images
|
||||
#print("gender prediction")
|
||||
|
||||
model = Gender.loadModel()
|
||||
@ -184,6 +184,7 @@ def analyze(img_path, actions= []):
|
||||
resp_obj += "\"gender\": \"%s\"" % (gender)
|
||||
|
||||
elif action == 'race':
|
||||
img = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images
|
||||
model = Race.loadModel()
|
||||
race_predictions = model.predict(img)[0,:]
|
||||
race_labels = ['asian', 'indian', 'black', 'white', 'middle eastern', 'latino hispanic']
|
||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ with open("README.md", "r", encoding="utf-8") as fh:
|
||||
|
||||
setuptools.setup(
|
||||
name="deepface",
|
||||
version="0.0.2",
|
||||
version="0.0.3",
|
||||
author="Sefik Ilkin Serengil",
|
||||
author_email="serengil@gmail.com",
|
||||
description="Deep Face Anaylsis Framework for Face Recognition and Demography",
|
||||
|
@ -6,6 +6,11 @@ import json
|
||||
print("Facial analysis tests")
|
||||
|
||||
img = "dataset/img4.jpg"
|
||||
demography = DeepFace.analyze(img)
|
||||
print(demography)
|
||||
|
||||
#-----------------------------------------
|
||||
|
||||
demography = DeepFace.analyze(img, ['age', 'gender', 'race', 'emotion'])
|
||||
|
||||
print("Demography:")
|
||||
|
Loading…
x
Reference in New Issue
Block a user