Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV GPU without compiling ?

Hello, i'm pretty new to OpenCV. I would like to use my GPU (Nvidia Geforce GTX 970) to run a Yolov3 (and 4) Neural Net. It works without any problems with my CPU but as you may already understand it's slow.

So I changed theses two lines in my code : (python3 script)

    self.net.setPreferableBackend(cv2.dnn.DNN_BACKEND_CUDA)
    self.net.setPreferableTarget(cv2.dnn.DNN_TARGET_CUDA)

1- I understood that "setPreferableTarget" set the hardware on which the neural network will be compute but what does "setPreferableBackend" do ? What is a Backend?

I tried to run my script and I get this warning :

[ WARN:0] global ../modules/dnn/src/dnn.cpp (1363) setUpNet DNN module was not built with CUDA backend; switching to CPU

2- I understood that means that OpenCV wasn't install with CUDA support, am I right here?

3- Isn't there any other way to install OpenCV with CUDA other than compile it from source? I installed OpenCV with sudo apt-get install libopencv-dev so i thought that maybe there is a way to do it like that, i don't know.

Thank you for taking the time to read me and thank you in advance for answering me, tell me if you need some additional information.