我想在 GeForce GTX 1080Ti 上执行物体检测。
我已经成功下载并安装了 CUDA 11.2 和 cuDNN 8.1(遵循本教程 https://towardsdatascience.com/yolov4-with-cuda-powered-opencv-dnn-2fef48ea3984)。 之后,我从源代码构建了 opencv-4.5.1,使用 CUDA_ARCH_BIN=6.1(在此处找到:https://developer.nvidia.com/cuda-gpus#compute)。
当我尝试执行检测时,我收到以下错误:
File "./image_detector.py", line 308, in make_prediction
outputs = self.net.forward(self.layer_names)
cv2.error: OpenCV(4.5.1) /home/ubuntu/opencvbuild/opencv/modules/dnn/src/dnn.cpp:2373: error: (-216:No CUDA support) OpenCV was not built to work with the selected device. Please check CUDA_ARCH_PTX or CUDA_ARCH_BIN in your build configuration. in function 'initCUDABackend'
我尝试使用 5.3 和 7.5 CUDA_ARCH_BIN 版本构建 OpenCV,但遇到了同样的错误。
这是我第一次使用 Nvidia GPU,我对它们之间的所有版本和兼容性感到有些困惑。
检查 CUDA 安装:
nvidia-smi
Fri Apr 2 07:02:04 2021
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 460.32.03 Driver Version: 460.32.03 CUDA Version: 11.2 |
|-------------------------------+----------------------+----------------------+
| GPU Name Persistence-M| Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap| Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|===============================+======================+======================|
| 0 GeForce GTX 108... On | 00000000:00:05.0 Off | N/A |
| 0% 24C P8 8W / 250W | 1MiB / 11178MiB | 0% Default |
| | | N/A |
+-------------------------------+----------------------+----------------------+
+-----------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=============================================================================|
| No running processes found |
+-----------------------------------------------------------------------------+
Nvcc 输出:
nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Sun_Feb_14_21:12:58_PST_2021
Cuda compilation tools, release 11.2, V11.2.152
Build cuda_11.2.r11.2/compiler.29618528_0
和位置:
which nvcc
/usr/local/cuda-11.2/bin/nvcc