nose and mouth unavailable case covered

This commit is contained in:
Sefik Ilkin Serengil 2024-10-05 22:30:20 +01:00
parent f7eb2d7873
commit 0ec185721e

View File

@ -42,16 +42,19 @@ class RetinaFaceClient(Detector):
# retinaface sets left and right eyes with respect to the person
left_eye = identity["landmarks"]["left_eye"]
right_eye = identity["landmarks"]["right_eye"]
nose = identity["landmarks"]["nose"]
mouth_right = identity["landmarks"]["mouth_right"]
mouth_left = identity["landmarks"]["mouth_left"]
nose = identity["landmarks"].get("nose")
mouth_right = identity["landmarks"].get("mouth_right")
mouth_left = identity["landmarks"].get("mouth_left")
# eyes are list of float, need to cast them tuple of int
left_eye = tuple(int(i) for i in left_eye)
right_eye = tuple(int(i) for i in right_eye)
nose = tuple(int(i) for i in nose)
mouth_right = tuple(int(i) for i in mouth_right)
mouth_left = tuple(int(i) for i in mouth_left)
if nose is not None:
nose = tuple(int(i) for i in nose)
if mouth_right is not None:
mouth_right = tuple(int(i) for i in mouth_right)
if mouth_left is not None:
mouth_left = tuple(int(i) for i in mouth_left)
confidence = identity["score"]