mirror of
https://github.com/serengil/deepface.git
synced 2025-06-07 12:05:22 +00:00
Prevent no attribute error when using Mtcnn
This commit is contained in:
parent
0833da1a4f
commit
f0f9a792ec
@ -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])
|
||||
|
@ -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"]
|
||||
|
Loading…
x
Reference in New Issue
Block a user