Gaebobman / Face_Recognition

Face recognition for jetson Nano
0 stars 0 forks source link

PIL.UnidentifiedImageError #4

Closed Gaebobman closed 1 year ago

Gaebobman commented 1 year ago

Traceback (most recent call last): File "detect_user.py", line 130, in main() File "detect_user.py", line 119, in main predictions = predict("data/test_data/visitor.png", model_path="data/trained_knn_model.clf") File "detect_user.py", line 35, in predict X_img = face_recognition.load_image_file(X_img_path) File "/usr/local/lib/python3.6/dist-packages/face_recognition/api.py", line 86, in load_image_file im = PIL.Image.open(file) File "/usr/local/lib/python3.6/dist-packages/PIL/Image.py", line 3031, in open "cannot identify image file %r" % (filename if filename else fp) PIL.UnidentifiedImageError: cannot identify image file 'data/test_data/visitor.png

Gaebobman commented 1 year ago

SOLVED: Copy and replace with this code line

X_img=None
    try:
        X_img = face_recognition.load_image_file(X_img_path)
    except PIL.UnidentifiedImageError:
        return None
    X_face_locations = face_recognition.face_locations(X_img)