From e67614ff7afef36f17a98fadbd5ae4bad71e0ea2 Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sun, 10 Mar 2024 09:08:29 +0000 Subject: [PATCH] exception handling in case of yolo has no keypoints --- deepface/detectors/Yolo.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/deepface/detectors/Yolo.py b/deepface/detectors/Yolo.py index debafc3..53e25ba 100644 --- a/deepface/detectors/Yolo.py +++ b/deepface/detectors/Yolo.py @@ -73,10 +73,17 @@ class YoloClient(Detector): # For each face, extract the bounding box, the landmarks and confidence for result in results: + + if result.boxes is None: + continue + # Extract the bounding box and the confidence x, y, w, h = result.boxes.xywh.tolist()[0] confidence = result.boxes.conf.tolist()[0] + if result.keypoints is None: + continue + # left_eye_conf = result.keypoints.conf[0][0] # right_eye_conf = result.keypoints.conf[0][1] left_eye = result.keypoints.xy[0][0].tolist()