1adrianb / face-alignment

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

Cannot use face-alignment in image loader #147

Closed ierezell closed 5 years ago

ierezell commented 5 years ago

In a project I need to load image and their landmarks.

Thanks to your wonderfull work I'm able to do it with this repo and the dataloader framework of pytorch.

But I got the error : RuntimeError: element 0 of tensors does not require grad and does not have a grad_fn

I can solve this by going in api.py => get_landmarks_from_image => l.177 => torch.set_grad_enabled(False) and changing it to True

I don't know if it's a bug or a feature, I patched it for my usecase but I think it can be improved.

Thanks again for your nice piece of software.

1adrianb commented 5 years ago

Thanks, this should be fixed now.