list index out of range when attempting to use face_processing
heaversm opened this issue · comments
Mike Heavers commented
running the following:
python dataset_utils.py --input_src ./img/ --output_dir ./faces/ --save_mode split --action face --w 256 --h 256 --centered --face_crop 0.7 --target_face_image ./targetface.jpg
where ./img/
is a directory relative to the script that has jpgs of all images with faces, and ./faces/
is an empty folder on the drive, and ./targetface.jpg
is a reference jpg. I get this error:
Traceback (most recent call last):
File "dataset_utils.py", line 236, in <module>
main(args)
File "dataset_utils.py", line 134, in main
target_encodings = get_encodings(target_face_image) if target_face_image else None
File "/home/paperspace/Projects/ml4a-guides/utils/face_processing.py", line 23, in get_encodings
target_encodings = face_recognition.face_encodings(target_face_img)[0]
IndexError: list index out of range
Gene Kogan commented
i think this happens if it doesn't find a face (either target or one of the frames). i need to add no-face-found handling here (or a PR would be welcome)...