diff --git a/deepface/detectors/FastMtCnn.py b/deepface/detectors/FastMtCnn.py index c43ed55..0b6f3a9 100644 --- a/deepface/detectors/FastMtCnn.py +++ b/deepface/detectors/FastMtCnn.py @@ -44,7 +44,7 @@ class FastMtCnnClient(Detector): detections = self.model.detect( img_rgb, landmarks=True ) # returns boundingbox, prob, landmark - if len(detections[0]) > 0: + if detections is not None and len(detections) > 0: for current_detection in zip(*detections): x, y, w, h = xyxy_to_xywh(current_detection[0]) diff --git a/deepface/detectors/MtCnn.py b/deepface/detectors/MtCnn.py index aefb5f6..66bdc07 100644 --- a/deepface/detectors/MtCnn.py +++ b/deepface/detectors/MtCnn.py @@ -46,7 +46,7 @@ class MtCnnClient(Detector): img_rgb = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # mtcnn expects RGB but OpenCV read BGR detections = self.model.detect_faces(img_rgb) - if len(detections) > 0: + if detections is not None and len(detections) > 0: for current_detection in detections: x, y, w, h = current_detection["box"]