
写真の顔について分析してみたいのですが。

先ほど利用したDeepFace を引き続き使ってみましょう。!

# from deepface import DeepFace
import pprint
# DeepFace を使用して画像解析
obj_analyze = DeepFace.analyze(
img_path=path + "img03.jpg",
actions=['age', 'gender', 'race', 'emotion'],
)
pprint.pprint(obj_analyze)
Action: emotion: 100%|██████████| 4/4 [00:02<00:00, 1.42it/s]
[{‘age’: 25,
‘dominant_emotion’: ‘happy’,
‘dominant_gender’: ‘Man’,
‘dominant_race’: ‘asian’,
‘emotion’: {‘angry’: 6.368043159454828e-05,
‘disgust’: 2.0789560351008873e-08,
‘fear’: 1.206806246045744e-05,
‘happy’: 99.79996085166931,
‘neutral’: 0.19902680069208145,
‘sad’: 0.0009018542186822742,
‘surprise’: 3.631662650604994e-05},
‘face_confidence’: 0.92,
‘gender’: {‘Man’: 99.97504353523254, ‘Woman’: 0.024955376284196973},
‘race’: {‘asian’: 99.9969840053339,
‘black’: 4.1501022667158185e-08,
‘indian’: 0.00014800568178597977,
‘latino hispanic’: 0.0026122787472590064,
‘middle eastern’: 1.349514228251595e-08,
‘white’: 0.0002495225929074647},
‘region’: {‘h’: 103,
‘left_eye’: (198, 88),
‘right_eye’: (156, 88),
‘w’: 103,
‘x’: 126,
‘y’: 48}}]


コメント