SFDDetector detect_from_image crashes on certain input. Noticed it when playing around with avatarify so I saved the current frame.
It looks like batch_detect should not be able to return an empty bboxlists, but it can be [[]] which slips through the length check at the end and causes an IndexError in detect_from_image
Here's the output when running facealignment_test.py with my image:
docker run --gpus all -it --rm -v $PWD/.cache:/root/.cache:rw -v $PWD/test:/workspace/face-alignment/test face-alignment python3 test/facealignment_test.py
E
======================================================================
ERROR: test_predict_points (__main__.Tester)
----------------------------------------------------------------------
Traceback (most recent call last):
File "test/facealignment_test.py", line 11, in test_predict_points
fa.get_landmarks('test/assets/crash.png')
File "/opt/conda/lib/python3.8/site-packages/face_alignment-1.1.1-py3.8.egg/face_alignment/api.py", line 107, in get_landmarks
return self.get_landmarks_from_image(image_or_path, detected_faces)
File "/opt/conda/lib/python3.8/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context
return func(*args, **kwargs)
File "/opt/conda/lib/python3.8/site-packages/face_alignment-1.1.1-py3.8.egg/face_alignment/api.py", line 140, in get_landmarks_from_image
detected_faces = self.face_detector.detect_from_image(image[..., ::-1].copy())
File "/opt/conda/lib/python3.8/site-packages/face_alignment-1.1.1-py3.8.egg/face_alignment/detection/sfd/sfd_detector.py", line 36, in detect_from_image
bboxlist = bboxlist[keep, :]
IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed
----------------------------------------------------------------------
Ran 1 test in 3.986s
FAILED (errors=1)
SFDDetector detect_from_image crashes on certain input. Noticed it when playing around with avatarify so I saved the current frame.
It looks like batch_detect should not be able to return an empty bboxlists, but it can be [[]] which slips through the length check at the end and causes an IndexError in detect_from_image
Here's the output when running facealignment_test.py with my image: