Ask Your Question

Can I run OpenCV DNN on NVidia GPU? code is writtin in python

asked 2019-03-15 18:04:28 -0500

nastaran1r gravatar image

updated 2019-03-16 02:30:41 -0500

berak gravatar image

I want to use my Nvidia GTX 1060 GPU when I run with my DNN code. my code is a python based. I am using OpenCV. I tried with CPU, However, It is absolutely slow. So, I change this line,




And then, I get an error that is [ WARN:0] DNN: OpenCL target is not supported with current OpenCL device (tested with Intel GPUs only), switching to CPU.

How Can I solve this problem and run dnn library code on my Nvidia GPU?

If I do the following settings it will be solved?

I download OpenCV and build from source, but I need to specify the right build flags for g++ to compile for GPU and CUDA, plus I will need to specify the architecture of the laptop GPU in the ARCH flag.

edit retag flag offensive close merge delete


Try to update OpenCV. OpenCL is now supported with non Intel GPUs. CUDA backend is our GSoC 2019 project.

dkurt gravatar imagedkurt ( 2019-03-16 00:41:23 -0500 )edit

OpenCL is still not working with OpenCV dnn. i have the last version of opencv @dkurt

PrincePaaris gravatar imagePrincePaaris ( 2019-03-16 04:45:10 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2019-03-16 04:56:39 -0500

For the moment you cannot. As far as I know the dnn module doesn't work with Nvidia GPU's

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-03-15 18:03:33 -0500

Seen: 2,041 times

Last updated: Mar 16 '19