serengil / deepface

A Lightweight Face Recognition and Facial Attribute Analysis (Age, Gender, Emotion and Race) Library for Python
https://bit.ly/deepface-py
MIT License
14.9k stars 2.25k forks source link

Unicode characters? #710

Closed bsleeman closed 1 year ago

bsleeman commented 1 year ago

Hi,

Any calls the extract_faces function that contain (at least this unicode character é) fail.

DeepFace.extract_faces(r"V:\Netlife_Retouching\Catholic Ladies' College - Eltham\2023\Portraits\7E\Amelia Mummé.jpg")

Traceback (most recent call last): File "<pyshell#45>", line 1, in DeepFace.extract_faces(r"V:\Netlife_Retouching\Catholic Ladies' College - Eltham\2023\Portraits\7E\Amelia Mummé.jpg") File "C:\Users\PrintRoom\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\DeepFace.py", line 787, in extract_faces img_objs = functions.extract_faces( File "C:\Users\PrintRoom\AppData\Local\Programs\Python\Python310\lib\site-packages\deepface\commons\functions.py", line 105, in extract_faces img_region = [0, 0, img.shape[1], img.shape[0]] AttributeError: 'NoneType' object has no attribute 'shape'

deepface 0.0.79 Windows10

Regards

bsleeman commented 1 year ago

Hi, further investigation has narrowed it down to the cv2.imread function being the failing culprit.

Regards,

serengil commented 1 year ago

Cannot reproduce this in Debian or MacOS.

bsleeman commented 1 year ago

Maybe only an issue with Windows? Have worked around it by processing the file into a numpy array.

img = cv2.imdecode(np.fromfile(img, dtype=np.uint8), cv2.IMREAD_UNCHANGED)

serengil commented 1 year ago

this is done with the latest PR