mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 03:55:21 +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)
|
print("Actions to do: ", actions)
|
||||||
|
|
||||||
img = functions.detectFace(img_path, (224, 224))
|
|
||||||
|
|
||||||
#TO-DO: do this in parallel
|
#TO-DO: do this in parallel
|
||||||
|
|
||||||
pbar = tqdm(range(0,len(actions)), desc='Finding actions')
|
pbar = tqdm(range(0,len(actions)), desc='Finding actions')
|
||||||
@ -163,6 +161,7 @@ def analyze(img_path, actions= []):
|
|||||||
resp_obj += emotion_obj
|
resp_obj += emotion_obj
|
||||||
|
|
||||||
elif action == 'age':
|
elif action == 'age':
|
||||||
|
img = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images
|
||||||
#print("age prediction")
|
#print("age prediction")
|
||||||
model = Age.loadModel()
|
model = Age.loadModel()
|
||||||
age_predictions = model.predict(img)[0,:]
|
age_predictions = model.predict(img)[0,:]
|
||||||
@ -171,6 +170,7 @@ def analyze(img_path, actions= []):
|
|||||||
resp_obj += "\"age\": %s" % (apparent_age)
|
resp_obj += "\"age\": %s" % (apparent_age)
|
||||||
|
|
||||||
elif action == 'gender':
|
elif action == 'gender':
|
||||||
|
img = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images
|
||||||
#print("gender prediction")
|
#print("gender prediction")
|
||||||
|
|
||||||
model = Gender.loadModel()
|
model = Gender.loadModel()
|
||||||
@ -184,6 +184,7 @@ def analyze(img_path, actions= []):
|
|||||||
resp_obj += "\"gender\": \"%s\"" % (gender)
|
resp_obj += "\"gender\": \"%s\"" % (gender)
|
||||||
|
|
||||||
elif action == 'race':
|
elif action == 'race':
|
||||||
|
img = functions.detectFace(img_path, (224, 224), False) #just emotion model expects grayscale images
|
||||||
model = Race.loadModel()
|
model = Race.loadModel()
|
||||||
race_predictions = model.predict(img)[0,:]
|
race_predictions = model.predict(img)[0,:]
|
||||||
race_labels = ['asian', 'indian', 'black', 'white', 'middle eastern', 'latino hispanic']
|
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(
|
setuptools.setup(
|
||||||
name="deepface",
|
name="deepface",
|
||||||
version="0.0.2",
|
version="0.0.3",
|
||||||
author="Sefik Ilkin Serengil",
|
author="Sefik Ilkin Serengil",
|
||||||
author_email="serengil@gmail.com",
|
author_email="serengil@gmail.com",
|
||||||
description="Deep Face Anaylsis Framework for Face Recognition and Demography",
|
description="Deep Face Anaylsis Framework for Face Recognition and Demography",
|
||||||
|
@ -6,6 +6,11 @@ import json
|
|||||||
print("Facial analysis tests")
|
print("Facial analysis tests")
|
||||||
|
|
||||||
img = "dataset/img4.jpg"
|
img = "dataset/img4.jpg"
|
||||||
|
demography = DeepFace.analyze(img)
|
||||||
|
print(demography)
|
||||||
|
|
||||||
|
#-----------------------------------------
|
||||||
|
|
||||||
demography = DeepFace.analyze(img, ['age', 'gender', 'race', 'emotion'])
|
demography = DeepFace.analyze(img, ['age', 'gender', 'race', 'emotion'])
|
||||||
|
|
||||||
print("Demography:")
|
print("Demography:")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user