ml4a / ml4a

A python library and collection of notebooks for making art with machine learning.

Home Page:https://ml4a.net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

list index out of range when attempting to use face_processing

heaversm opened this issue · comments

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

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)...