From 50dd5d7aa2cd0d7391914fb3d01e5a2d5c7635de Mon Sep 17 00:00:00 2001 From: Sefik Ilkin Serengil Date: Sat, 2 Mar 2024 12:26:02 +0000 Subject: [PATCH] fastmtcnn sometimes fails --- deepface/detectors/FastMtCnn.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/deepface/detectors/FastMtCnn.py b/deepface/detectors/FastMtCnn.py index f480643..1d6a416 100644 --- a/deepface/detectors/FastMtCnn.py +++ b/deepface/detectors/FastMtCnn.py @@ -27,8 +27,11 @@ class FastMtCnnClient(Detector): detections = self.model.detect( img_rgb, landmarks=True ) # returns boundingbox, prob, landmark - if detections is not None and len(detections) > 0: - + if ( + detections is not None + and len(detections) > 0 + and not any(detection is None for detection in detections) # issue 1043 + ): for current_detection in zip(*detections): x, y, w, h = xyxy_to_xywh(current_detection[0]) confidence = current_detection[1]