face-alignment icon indicating copy to clipboard operation
face-alignment copied to clipboard

Working with Cuda 11 and Cudnn 8

Open moncio opened this issue 4 years ago • 14 comments

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

moncio avatar Feb 03 '21 18:02 moncio

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

1adrianb avatar Feb 03 '21 19:02 1adrianb

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!

moncio avatar Feb 04 '21 12:02 moncio

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

1adrianb avatar Feb 04 '21 12:02 1adrianb

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

moncio avatar Feb 04 '21 13:02 moncio

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

moncio avatar Feb 04 '21 13:02 moncio

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.

1adrianb avatar Feb 04 '21 14:02 1adrianb

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!

moncio avatar Feb 04 '21 15:02 moncio

@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?

1adrianb avatar Feb 05 '21 02:02 1adrianb

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 avatar Feb 06 '21 12:02 moncio

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!

moncio avatar Feb 09 '21 15:02 moncio

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?

1adrianb avatar Feb 09 '21 18:02 1adrianb

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

moncio avatar Feb 10 '21 07:02 moncio

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

1adrianb avatar Feb 10 '21 09:02 1adrianb

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

moncio avatar Feb 10 '21 09:02 moncio