matiasdelellis / facerecognition-external-model

Nextcloud Facerecognition External Model

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GPU Usage on External-model

ftrentini opened this issue · comments

Hi, I know this is not the channel to send this kind of message, but I tried to use GPU to process externally and I really don't know if it's working. My server is processor only, but is processing faster than the dedicated external-model server GPU powered I built just to face recognition. Is there a way to really know if the model is using GPU?

Depending on the GPU you use, there may be a utility available to observe GPU usage.
I'm interest to know what you did to try using your GPU

My dedicated server has a GTX1060 plugged on a Xeon E5-2520, with 16GB of RAM. Connected by gigabit ethernet to the webserver.
And my doubt about it is just because the gpustat command showed me the usage was only about 1-2%.

So you're just using python dlib without any changes? It's just a set of bindings to the dlib library, and if the library doesn't support your GPU, (or isn't built with cuda/whatever support), you aren't going to get GPU. Try this:

$ python
Python 3.10.2 (main, Jan 17 2022, 00:00:00) [GCC 11.2.1 20211203 (Red Hat 11.2.1-7)] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
>>> dlib.DLIB_USE_CUDA
False

If it doesn't return True (you see mine reports False even though I have a GTX 980), you don't have support for it in your dlib library.

Hmmmm, enlightenment!

5da77a0994cbe2f3631a90d63f298a0e
`

Solved. STEP BY STEP:

  • Had to install CUDA and reinstall Nvidia drivers. I did altogether by downloading and install from nvidia cuda toolkit site. Choose your system, download and run.
  • cuDNN: Tricky, I had to join Nvidia's dev community. I am not a dev, but doesn't matter. Followed this page: nvidia cuDNN libs. And I followed nvidia's instructions.

After that, I:

  • Rebuild DLIB from scratch.
  • Reinstall DLIB on python.
  • Rebuild pdlib from scratch

And violà:

Python 3.8.10 (default, Nov 26 2021, 20:14:08) 
[GCC 9.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import dlib
>>> dlib.DLIB_USE_CUDA
True
>>> 

and PHP

image

Tested. Working like a charm! Now I can try to process all my 240k+ photos!! 😄

Thanks a lot @guystreeter and @matiasdelellis