简体   繁体   English

dlib cuda 不使用 GPU

[英]dlib cuda not using GPU

I wanted to improve my CNN facial recognition code by using Nvidia GPU instead of CPU.我想通过使用 Nvidia GPU 而不是 CPU 来改进我的 CNN 面部识别代码。 So I found and install specific dlib_cuda following these instructions .所以我按照这些说明找到并安装了特定的 dlib_cuda。

Installation went well, and so I checked if dlib using cuda in my Python environment:安装很顺利,所以我检查了 dlib 在我的 Python 环境中是否使用 cuda:

Python 3.6.9 (default, Jul  17 2020, 12:50:27)
[GCC 8.4.0] on linux
>>> import dlib
>>> dlib.DLIB_USE_CUDA
True
>>>print(dlib.cuda.get_device())
1

Because it looked good for me, I tried to use my code again, but they was no improvement, and after checking GPU, it is still not use at all.因为它看起来对我来说很好,所以我尝试再次使用我的代码,但它们没有任何改进,并且在检查 GPU 之后,它仍然根本无法使用。 So I tried the following command:所以我尝试了以下命令:

>>> print(dlib.cuda.get_device())

And it returns:它返回:

0

I'm not sure of what these this messages means.我不确定这些消息的含义。 After a lot of researches and I cannot still figure with dlib doesn't use my GPU. Is someone faced the same issue before?经过大量研究,我仍然无法确定 dlib 不使用我的 GPU。以前有人遇到过同样的问题吗?

My workspace is on a Jetson AGX Xavier (Jetpack 4.4), running with Ubuntu and Cuda version 10.2.89我的工作区在 Jetson AGX Xavier (Jetpack 4.4) 上,运行 Ubuntu 和 Cuda 版本 10.2.89

PS: I also use tensorFlow and Keras libraries, both of them are install to work with CUDA environments PS:我还使用 tensorFlow 和 Keras 库,它们都安装在 CUDA 环境中

If you are familiar with Tensorflow and Keras, I recommend you to use deepface for face recognition.如果你熟悉Tensorflow和Keras,我推荐你使用deepface进行人脸识别。 It wraps state-of-the-art face recognition models and builds Keras models in the background.它封装了最先进的人脸识别模型,并在后台构建了 Keras 个模型。 That's why, its default usage will perform on GPU if you installed tensorflow-gpu package.这就是为什么,如果您安装了 tensorflow-gpu package,它的默认用法将在 GPU 上执行。

#!pip install deepface
from deepface import DeepFace
models = ["VGG-Face", "Facenet", "OpenFace", "DeepFace", "DeepID"]
resp = DeepFace.verify("img1.jpg", "img2.jpg", model_name = models[0])
print(resp["verified"])

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM