ageitgey / face_recognition

The world's simplest facial recognition api for Python and the command line
MIT License
53.23k stars 13.48k forks source link

Passing the error #447

Open hanckmail opened 6 years ago

hanckmail commented 6 years ago

For example, Im using the following code

import face_recognition
import pickle

all_face_encodings = {}

img1 = face_recognition.load_image_file("obama.jpg")
all_face_encodings["obama"] = face_recognition.face_encodings(img1)[0]

img2 = face_recognition.load_image_file("biden.jpg")
all_face_encodings["biden"] = face_recognition.face_encodings(img2)[0]

# ... etc ...

with open('dataset_faces.dat', 'wb') as f:
    pickle.dump(all_face_encodings, f)

When biden.jpg image is corrupted or have more than one face i got this error IndexError: list index out of range how can i pass this image and error without script stopping. Thank you.

ageitgey commented 6 years ago

See https://github.com/ageitgey/face_recognition/wiki/Common-Errors#list-index-out-of-range-errors

hanckmail commented 6 years ago

thank you i will try