Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image with many faces : top_emotion #21

Open
seghier opened this issue May 14, 2021 · 1 comment
Open

Image with many faces : top_emotion #21

seghier opened this issue May 14, 2021 · 1 comment

Comments

@seghier
Copy link

seghier commented May 14, 2021

Hello
When the image have different faces with different emotions : detector.top_emotion(image) give only the top of the first face;
how we can get top list of all faces?

@seghier
Copy link
Author

seghier commented May 14, 2021

I find a solution, i think you can do the same in the original code

result = detector.detect_emotions(img)
print (len(result))
for i in range(len(result)):
    top_emotions = [max(e["emotions"], key=lambda key: e["emotions"][key]) for e in result]
    top_emotion = top_emotions[i]
    score = result[i]["emotions"][top_emotion]
    print (top_emotion, score)

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant