Hi,
i’m trying to run a python script based on yolov3 on GPU of my Jetson Tx2.
I get this error:
opencv /modules/dnn/src/dnn.cpp (1363) setupnet dnn module was not built with cuda backend; switching to cpu
Following some forum developers answear i started to re-build opencv with:
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr
-D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib/modules
-D EIGEN_INCLUDE_PATH=/usr/include/eigen3
-D WITH_OPENCL=OFF
-D WITH_CUDA=ON
-D CUDA_ARCH_BIN=6.2
-D CUDA_ARCH_PTX=“”
-D WITH_CUDNN=ON
-D WITH_CUBLAS=ON
-D ENABLE_FAST_MATH=ON
-D CUDA_FAST_MATH=ON
-D OPENCV_DNN_CUDA=ON
-D ENABLE_NEON=ON
-D WITH_QT=OFF
-D WITH_OPENMP=ON
-D WITH_OPENGL=ON
-D BUILD_TIFF=ON
-D WITH_FFMPEG=ON
-D WITH_GSTREAMER=ON
-D WITH_TBB=ON
-D BUILD_TBB=ON
-D BUILD_TESTS=OFF
-D WITH_EIGEN=ON
-D WITH_V4L=ON
-D WITH_LIBV4L=ON
-D OPENCV_ENABLE_NONFREE=ON
-D INSTALL_C_EXAMPLES=OFF
-D INSTALL_PYTHON_EXAMPLES=OFF
-D BUILD_NEW_PYTHON_SUPPORT=ON
-D BUILD_opencv_python3=TRUE
-D OPENCV_GENERATE_PKGCONFIG=ON
-D BUILD_EXAMPLES=OFF …
I get the following warning:
/usr/bin/ld: skipping incompatible /usr/local/cuda-10.2/lib64/libcudnn.so when searching for -lcudnn
/usr/bin/ld: skipping incompatible /usr/local/cuda-10.2/lib64/libcudnn.so when searching for -lcudnn
/usr/bin/ld: skipping incompatible /usr/local/cuda-10.2/lib64/libcudnn.so when searching for -lcudnn
/usr/bin/ld: skipping incompatible /usr/local/cuda-10.2/lib64/libcudnn.so when searching for -lcudnn
/usr/bin/ld: skipping incompatible /usr/local/cuda-10.2/lib64/libcudnn.so when searching for -lcudnn
/usr/bin/ld: skipping incompatible /usr/local/cuda-10.2/lib64/libcudnn.so when searching for -lcudnn
I get this warning when “Linking CXX shared library …/…/lib/libopencv_***.so” is running with every libopencv.so target library.
The building process continues, then i install everything but at the end after running my python script i get the same error/warning of the beginning:
opencv /modules/dnn/src/dnn.cpp (1363) setupnet dnn module was not built with cuda backend; switching to cpu
What is the problem?
OpenCV 4.5.1
Cuda 10.2
cuDNN 8.6.0
Jetpack 4.6.2
Hi,
We got a topic that reports a similar issue:
It looks like the GPU support is turned off somehow.
We are checking this internally. Please wait for our update.
Thanks.
-
Clear your build and try again with the cmake-gui, where you make sure to enable BUILD_OPENCV_WORLD=ON
BUILD_OPENCV_DNN= ON
and change your cmake_install_prefix to /usr/local
and also check if the your python3 paths for executable, inlcude dir, library, numpy_inlcude_dirs, packages_path are set correct. -
You would have to configure the second time with all these options enable these options along with others and generate.
How To Install and Build OpenCV with GPU for C++ | Visual Studio Code | NVIDIA Cuda and OpenCV 4.5.2 - YouTube
Build and install OpenCV from source with CUDA and cuDNN support - YouTube -
Check in the configuration log, if CUDNN has been set to the value you assigned.
If not, make sure to add the libcudnn.so to the CUDNN_LIBRARY and your include path to CUDNN_INCLUDE_DIR
after that, make sure you have the libopencv_world.so file in your /usr/local/lib (usually)
and adding this to the platform you use, like Visual Studio should work.