Closed jared252016 closed 7 months ago
You should downgrade your tensorflow version.
I fixed retinaface's issue but not published in pip yet.
For mtcnn, exception message is clear. Please confirm that the picture is a face photo or consider to set enforce_detection param to False.
You can add that argument as:
DeepFace.analyze(img_path=img_path, actions=['gender', 'race'], detector_backend = "mtcnn", enforce_detection=False)
I'm trying to use the gender estimation feature (and as a bonus race estimation), but none of the models seem to work. This is using the latest released version as of today (from pip).
` from deepface import DeepFace import os
def verify_face(gender):
verify_face('male') `
Using retinaface: ` Error analyzing gibsway5jx1c1_FACE_MALE_MEDIUM.jpg: Exception encountered when calling MaxPooling2D.call().
Argument
padding
must be either 'valid' or 'same'. Received: padding=VALIDArguments received by MaxPooling2D.call(): • args=('<KerasTensor shape=(None, None, None, 64), dtype=float32, sparse=False, name=keras_tensor_5>',) • kwargs=<class 'inspect._empty'> `
Using mtcnn:
1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 311ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 0s 451ms/step 1/1 ━━━━━━━━━━━━━━━━━━━━ 1s 571ms/step Action: gender: 0%| | 0/2 [00:00<?, ?it/s] Error analyzing 13fmpybk321b1_FACE_MALE_MEDIUM.jpg: The layer sequential has never been called and thus has no defined input.
Using yolov8:
24-03-12 04:36:44 - Downloading Yolo weights from https://drive.google.com/uc?id=1qcr9DbgsX3ryrz2uU8w4Xm3cOrRywXqb to /home/user/.deepface/weights/yolov8n-face.pt... Error analyzing gibsway5jx1c1_FACE_MALE_MEDIUM.jpg: Exception while downloading Yolo weights from https://drive.google.com/uc?id=1qcr9DbgsX3ryrz2uU8w4Xm3cOrRywXqb.You may consider to download it to /home/user/.deepface/weights/yolov8n-face.pt manually. 24-03-12 04:36:46 - Downloading Yolo weights from https://drive.google.com/uc?id=1qcr9DbgsX3ryrz2uU8w4Xm3cOrRywXqb to /home/user/.deepface/weights/yolov8n-face.pt... Error analyzing 13fmpybk321b1_FACE_MALE_MEDIUM.jpg: Exception while downloading Yolo weights from https://drive.google.com/uc?id=1qcr9DbgsX3ryrz2uU8w4Xm3cOrRywXqb.You may consider to download it to /home/user/.deepface/weights/yolov8n-face.pt manually. 24-03-12 04:36:47 - Downloading Yolo weights from https://drive.google.com/uc?id=1qcr9DbgsX3ryrz2uU8w4Xm3cOrRywXqb to /home/user/.deepface/weights/yolov8n-face.pt... Error analyzing 6yyzhhjcdif61_FACE_MALE_HIGH.jpg: Exception while downloading Yolo weights from https://drive.google.com/uc?id=1qcr9DbgsX3ryrz2uU8w4Xm3cOrRywXqb.You may consider to download it to /home/user/.deepface/weights/yolov8n-face.pt manually.
This is regardless of the file existing in that path (I downloaded it manually)Using dlib:
Error analyzing town86kydxra1_FACE_MALE_HIGH.jpg: The layer sequential_20 has never been called and thus has no defined input. Action: gender: 0%| | 0/2 [00:00<?, ?it/s] Error analyzing a7q29hntvomb1_FACE_MALE_LOW.jpg: The layer sequential_22 has never been called and thus has no defined input. Error analyzing v0x4sxvkr8gc1_frame528_FACE_MALE_LOW.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/v0x4sxvkr8gc1_frame528_FACE_MALE_LOW.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing 8m56sp2a827c1_FACE_MALE_MEDIUM.png: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/8m56sp2a827c1_FACE_MALE_MEDIUM.png.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Action: gender: 0%| | 0/2 [00:00<?, ?it/s] Error analyzing 4wfyu8muv18b1_FACE_MALE_HIGH.jpg: The layer sequential_24 has never been called and thus has no defined input. Error analyzing lo9g5j94iqfc1_FACE_MALE_MEDIUM.jpg: Exception while extracting faces from /data/models/fama-4m/media_parts/FACE_MALE/lo9g5j94iqfc1_FACE_MALE_MEDIUM.jpg.Consider to set enforce_detection arg to False. Error analyzing x679om91znkb1_FACE_MALE_HIGH.png: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/x679om91znkb1_FACE_MALE_HIGH.png.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing 12juz4v48pec1_frame126_FACE_MALE_MEDIUM.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/12juz4v48pec1_frame126_FACE_MALE_MEDIUM.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing g7eah37ev3ic1_FACE_MALE_LOW.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/g7eah37ev3ic1_FACE_MALE_LOW.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing u4p083789ld51_FACE_MALE_MEDIUM.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/u4p083789ld51_FACE_MALE_MEDIUM.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing 157k3pmtw43b1_FACE_MALE_LOW.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/157k3pmtw43b1_FACE_MALE_LOW.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing t775vko7b04c1_FACE_MALE_HIGH.png: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/t775vko7b04c1_FACE_MALE_HIGH.png.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Action: gender: 0%| | 0/2 [00:00<?, ?it/s] Error analyzing qj95p9w91v771_FACE_MALE_MEDIUM.jpg: The layer sequential_26 has never been called and thus has no defined input. Error analyzing 186ykmutqebc1_FACE_MALE_MEDIUM.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/186ykmutqebc1_FACE_MALE_MEDIUM.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Action: gender: 0%| | 0/2 [00:00<?, ?it/s] Error analyzing od3i8x7nfdk51_FACE_MALE_VERY-LOW.jpg: The layer sequential_28 has never been called and thus has no defined input. Error analyzing bzu7qufzknjc1_FACE_MALE_LOW.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/bzu7qufzknjc1_FACE_MALE_LOW.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing 3p4f7bf2zii51_FACE_MALE_MEDIUM.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/3p4f7bf2zii51_FACE_MALE_MEDIUM.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing o7jmjk74htkb1_FACE_MALE_LOW.jpg: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/o7jmjk74htkb1_FACE_MALE_LOW.jpg.Please confirm that the picture is a face photo or consider to set enforce_detection param to False. Error analyzing hxsinxd94vcc1_FACE_MALE_LOW.png: Face could not be detected in /data/models/fama-4m/media_parts/FACE_MALE/hxsinxd94vcc1_FACE_MALE_LOW.png.Please confirm that the picture is a face photo or consider to set enforce_detection param to False.