Installing Dlib with CUDA support on Jetson Nano with JetPack 4.6.1

Here are the instructions I followed initially to install DLib without CUDA support:

$ sudo apt update
$ sudo apt upgrade
$ wget http://dlib.net/files/dlib-19.17.tar.bz2
$ tar jxvf dlib-19.17.tar.bz2
$ tar jxvf dlib-19.17.tar.bz2
$ cd dlib-19.17/
$ gedit dlib/cuda/cudnn_dlibapi.cpp
In the above file, you have to search for forward_algo... = forawrd_....
Comment out this line.
after that go back to the main dlib-19.17 folder 
$ sudo python3 setup.py install
Finally,
$ sudo pip3 install face_recognition

I wish to re-install DLib with CUDA support, so would running the commands below, setup CUDA support for DLib?

$ sudo apt update
$ sudo apt upgrade
$ wget http://dlib.net/files/dlib-19.17.tar.bz2
$ tar jxvf dlib-19.17.tar.bz2
$ tar jxvf dlib-19.17.tar.bz2
$ cd dlib-19.17/
$ gedit dlib/cuda/cudnn_dlibapi.cpp
In the above file, you have to search for forward_algo... = forawrd_....
Comment out this line.
after that go back to the main dlib-19.17 folder 
$ sudo python3 setup.py install --set DLIB_USE_CUDA=1
Finally,
$ sudo pip3 install face_recognition

Does using the --set DLIB_USE_CUDA=1 flag all that’s required to set up CUDA support?

Or do I have to use the $ sudo python3 setup.py install -- -D DLIB_USE_CUDA=1 command instead of the $ sudo python3 setup.py install --set DLIB_USE_CUDA=1 command for CUDA support on the Nano?

Hi,

Could you give dlib 19.21 a try?
The CUDA support is enabled by default.

Thanks.

1 Like

@AastaLLL Is DLib19.21 supported on the Jetson Nano?

PS: I’m using JetPack 4.6.1

@AastaLLL Please confirm.

@AastaLLL THANKS A TON! I’ve installed DLib with CUDA support on my Jetson Nano.

I just hope facial recognition runs at a better frame rate now.

@AastaLLL Now that I have DLib installed with CUDA support, does just having the line import face_recognition run the facial recognition code on the GPU? Or do I need any additional configurations to be done for the facial recognition code using DLib to run on the GPU?

Hey @AastaLLL after installing DLib 19.21 on my nano with CUDA support the the facial recognition program that used to run at about 5fps, not does not even run, after running the code on the terminal, I don’t see the live feed from the webcams. What could be the reason for this?

Hi,

Is there any error or does the application just get stuck?
Could you try to re-install the package to make sure it links to the dlib 19.21?

$ sudo pip3 install face_recognition

Thanks.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.