1adrianb / face-alignment

:fire: 2D and 3D Face alignment library build using pytorch
https://www.adrianbulat.com
BSD 3-Clause "New" or "Revised" License
7.11k stars 1.35k forks source link

get_landmarks_from_directory error. #280

Closed ruanjiyang closed 3 years ago

ruanjiyang commented 3 years ago

Dear 1adrianb

I tried to run following simply python script:

import face_alignment from skimage import io fa = face_alignment.FaceAlignment(face_alignment.LandmarksType._2D, flip_input=False) preds = fa.get_landmarks_from_directory('./misc/Input/517600055/')

===============================

but I got following errors. could you please help me? thanks!

TypeError: expected dtype object, got 'numpy.dtype[float32]'

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "scripts/align_68.py", line 118, in preds = fa.get_landmarks_from_directory('./misc/Input/517600055/') File "/home/ruanjiyang/anaconda3/lib/python3.7/site-packages/face_alignment/api.py", line 238, in get_landmarks_from_directory preds = self.get_landmarks_from_image(image, bounding_boxes) File "/home/ruanjiyang/anaconda3/lib/python3.7/site-packages/torch/autograd/grad_mode.py", line 26, in decorate_context return func(*args, **kwargs) File "/home/ruanjiyang/anaconda3/lib/python3.7/site-packages/face_alignment/api.py", line 154, in get_landmarks_from_image pts, pts_img = get_preds_fromhm(out, center.numpy(), scale) File "/home/ruanjiyang/anaconda3/lib/python3.7/site-packages/face_alignment/utils.py", line 199, in get_preds_fromhm preds, preds_orig = _get_preds_fromhm(hm, idx, center, scale) SystemError: CPUDispatcher(<function _get_preds_fromhm at 0x7f9210f57c20>) returned a result with an error set

1adrianb commented 3 years ago

Could you please try updating numba to the latest version? This is likely due to some incompatibility between your numpy and numba version.