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.03k stars 1.34k forks source link

Working with Cuda 11 and Cudnn 8 #253

Open moncio opened 3 years ago

moncio commented 3 years ago

Hi, this is more a question than an issue.

I have a system with RTX 3080, Driver version 450.102, Ubuntu 20.04, Cuda 11.03 and Cudnn 8.0.5 My question, is the library ready to work with this type of configuration? I also usually work with blazeface detector. @1adrianb

Thanks in advance

1adrianb commented 3 years ago

Hi @moncio This interfacing is handled by pytorch, as such this shouldn't be an issue. Just make sure that you install an appropriate pytorch version ( see https://pytorch.org/get-started/locally/)

moncio commented 3 years ago

Sorry again @1adrianb . I opened this question because I found this issue in this environment:

image

This is my code to initialize the library:

 self.face_alignment = FaceAlignment(landmarks_type=LandmarksType._3D,
                                            flip_input=False,
                                            device='cuda',
                                            face_detector='blazeface')

However, when I run the same code under Ubuntu 18.04, Cuda 10.0 and Cudnn 7.6.5, the program runs succesfully. As well, if I checkit with sfd detector, it works.

So, do I need to do some adjustment in order to use the blazeface properly?

Thanks!

1adrianb commented 3 years ago

Can you please try updating the face alignment lib to the latest version? (1.3.3)

moncio commented 3 years ago

Ok, I was running with v1.1.1. I will update it and try again. Thanks!

moncio commented 3 years ago

Hi again @1adrianb . Bad news, when I run v1.3.3 with blazeface, same error I posted before.

On the other hand, when I run with sfd:

image

Trying with dlib detector, the same error.

It seems the main problem is here:

out = self.face_alignment_net(inp).detach()

1adrianb commented 3 years ago

According to the error trace this seems to be an issue with your nvidia/cuda installation: failed to open libnvrtc-builtins.so. Please make sure this is installed and added to your path.

moncio commented 3 years ago

Well, in this case I'm building a docker image from this: https://hub.docker.com/r/nvidia/cuda/tags?page=1&ordering=last_updated

Using this image: nvidia/cuda:11.0.3-cudnn8-devel-ubuntu20.04

Anyway, I will check this specific library.

But, the problem regarding to blazeface? Invalid shape dimension? I dont understand it. @1adrianb

Thanks!

1adrianb commented 3 years ago

@moncio I am unable to reproduce the issue at the moment on my system. Could you check please if after fixing the missing library the error still occurs?

moncio commented 3 years ago

Ok, now running with Cuda 11.0 and trying your example script: [https://github.com/1adrianb/face-alignment/blob/master/examples/detect_landmarks_in_image.py]() . it seems it works great at least with blazeface

But when I'm trying to Cuda 11.1 the problems come regarding to torch (But this error is more about compatibility of versions) This is the message:

RuntimeError: Unexpected error from cudaGetDeviceCount(). Did you run some cuda functions before calling NumCudaDevices() that might have already set an error? Error 804: forward compatibility was attempted on non supported HW

Thanks for the help @1adrianb

moncio commented 3 years ago

Sorry again @1adrianb but the problem about RuntimeError: invalid shape dimension -1061950504 persists.

I'm running a code with a video as an input source inside a image with Cuda 11.0.3, Cudnn 8.0.5 and Python 3.8 Do you have any example like that to try it?

Thanks!

1adrianb commented 3 years ago

Could you please try running the test suite, available in test folder? Also, does the code provided here: https://github.com/1adrianb/face-alignment/blob/master/examples/demo.ipynb work? Finally, does sdf instead of blazeface work?

moncio commented 3 years ago

Where is this video "acazlolrpz.mp4" which you refer in the script? I tried with sfd and it's working but the GPU memory comsumption is quite higher than the other one and the speed slower

1adrianb commented 3 years ago

@moncio Thanks for checking. If you can give me some details regarding the video (resolution at least), or if you can send me the frame that causes the crash I can try to reproduce your error in a container.

moncio commented 3 years ago

Yes, the resolution is 1920x1080, frame rate 30. Sorry but I can`t pass to you the video. I'm not authorized.