I am using OpenCV 4.8.0 and also make sure CuDNN and CUDA is installed from below command:
cmake -D CMAKE_BUILD_TYPE=RELEASE
-D CMAKE_INSTALL_PREFIX=/usr/local
-D INSTALL_PYTHON_EXAMPLES=ON
-D INSTALL_C_EXAMPLES=OFF
-D OPENCV_ENABLE_NONFREE=ON
-D WITH_CUDA=ON
-D WITH_CUDNN=ON
-D WITH_CUDNN=ON
-D OPENCV_DNN_CUDA=ON
-D ENABLE_FAST_MATH=1
-D BUILD_OPENCV_WORLD=ON
-D CUDA_FAST_MATH=1
-D CUDA_ARCH_BIN=8.7
-D WITH_CUBLAS=1
-D OPENCV_DNN_CUDA=ON
-D ENABLE_FAST_MATH=1
-D CUDA_FAST_MATH=1
-D CUDA_ARCH_BIN=6.1
-D WITH_CUBLAS=1
-D OPENCV_EXTRA_MODULES_PATH=/home/neeraj/Applications/OpenCV/opencv_contrib/modules
-D CUDNN_LIBRARY=/usr/lib/cuda/lib64/libcudnn.so.8.9.5
-D CUDNN_INCLUDE_DIR=/usr/lib/cuda/include
-D HAVE_opencv_python3=ON
-D PYTHON_EXECUTABLE=~/.virtualenvs/opencv_dnn_cuda/bin/python
-D BUILD_EXAMPLES=OFF β¦
from below output:
β ocv_init_download: OpenCV source tree is not fetched as git repository. 3rdparty resources will be downloaded from github.com by default.
β Detected processor: x86_64
CMake Warning (dev) at cmake/OpenCVUtils.cmake:144 (find_package):
Policy CMP0148 is not set: The FindPythonInterp and FindPythonLibs modules
are removed. Run βcmake --help-policy CMP0148β for policy details. Use
the cmake_policy command to set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/OpenCVDetectPython.cmake:64 (find_host_package)
cmake/OpenCVDetectPython.cmake:271 (find_python)
CMakeLists.txt:649 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
β Looking for ccache - found (/usr/bin/ccache)
β Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found suitable version β1.2.11β, minimum required is β1.2.3β)
Cleaning INTERNAL cached variable: WEBP_LIBRARY
Cleaning INTERNAL cached variable: WEBP_INCLUDE_DIR
β Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
β OpenJPEG: VERSION = 2.5.0, BUILD = opencv-4.8.0-openjp2-2.5.0
β OpenJPEG libraries will be built from sources: libopenjp2 (version β2.5.0β)
β Found ZLIB: /usr/lib/x86_64-linux-gnu/libz.so (found version β1.2.11β)
β Found OpenEXR: /usr/lib/x86_64-linux-gnu/libIlmImf-2_5.so
β libva: missing va.h header (VA_INCLUDE_DIR)
β found Intel IPP (ICV version): 2021.8.0 [2021.8]
β at: /home/neeraj/Applications/OpenCV/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
β found Intel IPP Integration Wrappers sources: 2021.8.0
β at: /home/neeraj/Applications/OpenCV/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
CMake Warning (dev) at cmake/OpenCVUtils.cmake:144 (find_package):
Policy CMP0146 is not set: The FindCUDA module is removed. Run βcmake
βhelp-policy CMP0146β for policy details. Use the cmake_policy command to
set the policy and suppress this warning.
Call Stack (most recent call first):
cmake/OpenCVDetectCUDA.cmake:21 (find_host_package)
cmake/OpenCVFindLibsPerf.cmake:43 (include)
CMakeLists.txt:756 (include)
This warning is for project developers. Use -Wno-dev to suppress it.
β CUDA detected: 11.5
β CUDA: Using CUDA_ARCH_BIN=6.1
β CUDA NVCC target flags: -gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
β Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
β Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
β Could NOT find Atlas (missing: Atlas_CLAPACK_INCLUDE_DIR)
β VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
β Checking for module βlibavresampleβ
β No package βlibavresampleβ found
β freetype2: YES (ver 24.1.18)
β harfbuzz: YES (ver 2.7.4)
β Could NOT find HDF5 (missing: HDF5_LIBRARIES HDF5_INCLUDE_DIRS) (found version ββ)
β Julia not found. Not compiling Julia Bindings.
β Module opencv_ovis disabled because OGRE3D was not found
β No preference for use of exported gflags CMake configuration set, and no hints for include/library directories provided. Defaulting to preferring an installed/exported gflags CMake configuration if available.
β Failed to find installed gflags CMake configuration, searching for gflags build directories exported with CMake.
β Failed to find gflags - Failed to find an installed/exported CMake configuration for gflags, will perform search for installed gflags components.
β Failed to find gflags - Could not find gflags include directory, set GFLAGS_INCLUDE_DIR to directory containing gflags/gflags.h
β Failed to find glog - Could not find glog include directory, set GLOG_INCLUDE_DIR to directory containing glog/logging.h
β Module opencv_sfm disabled because the following dependencies are not found: Glog/Gflags
β Checking for module βtesseractβ
β No package βtesseractβ found
β Tesseract: NO
β Allocator metrics storage type: βlong longβ
β Excluding from source files list: modules/imgproc/src/imgwarp.lasx.cpp
β Excluding from source files list: modules/imgproc/src/resize.lasx.cpp
β Registering hook βINIT_MODULE_SOURCES_opencv_dnnβ: /home/neeraj/Applications/OpenCV/opencv/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
β Excluding from source files list: /modules/dnn/layers/layers_common.rvv.cpp
β Excluding from source files list: /modules/dnn/layers/layers_common.lasx.cpp
β Excluding from source files list: /modules/dnn/int8layers/layers_common.lasx.cpp
β Excluding from source files list: /modules/dnn/layers/cpu_kernels/conv_depthwise.rvv.cpp
β Excluding from source files list: /modules/dnn/layers/cpu_kernels/conv_depthwise.lasx.cpp
β highgui: using builtin backend: GTK3
β Building with NVIDIA Optical Flow API 2.0
β Found βmiscβ Python modules from /home/neeraj/Applications/OpenCV/opencv/modules/python/package/extra_modules
β Found βmat_wrapper;utilsβ Python modules from /home/neeraj/Applications/OpenCV/opencv/modules/core/misc/python/package
β Found βgapiβ Python modules from /home/neeraj/Applications/OpenCV/opencv/modules/gapi/misc/python/package
β Found βmiscβ Python modules from /home/neeraj/Applications/OpenCV/opencv/modules/python/package/extra_modules
β Found βmat_wrapper;utilsβ Python modules from /home/neeraj/Applications/OpenCV/opencv/modules/core/misc/python/package
β Found βgapiβ Python modules from /home/neeraj/Applications/OpenCV/opencv/modules/gapi/misc/python/package
β General configuration for OpenCV 4.8.0 =====================================
β Version control: unknown
β Extra modules:
β Location (extra): /home/neeraj/Applications/OpenCV/opencv_contrib/modules
β Version control (extra): unknown
β Platform:
β Timestamp: 2023-09-28T11:17:53Z
β Host: Linux 6.2.0-33-generic x86_64
β CMake: 3.27.4
β CMake generator: Unix Makefiles
β CMake build tool: /usr/bin/gmake
β Configuration: RELEASE
β CPU/HW features:
β Baseline: SSE SSE2 SSE3
β requested: SSE3
β Dispatched code generation: SSE4_1 SSE4_2 FP16 AVX AVX2 AVX512_SKX
β requested: SSE4_1 SSE4_2 AVX FP16 AVX2 AVX512_SKX
β SSE4_1 (18 files): + SSSE3 SSE4_1
β SSE4_2 (2 files): + SSSE3 SSE4_1 POPCNT SSE4_2
β FP16 (1 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 AVX
β AVX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
β AVX2 (37 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
β AVX512_SKX (8 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2 AVX_512F AVX512_COMMON AVX512_SKX
β C/C++:
β Built as dynamic libs?: YES
β C++ standard: 11
β C++ Compiler: /usr/bin/c++ (ver 11.4.0)
β C++ flags (Release): -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -O3 -DNDEBUG -DNDEBUG
β C++ flags (Debug): -fsigned-char -ffast-math -W -Wall -Wreturn-type -Wnon-virtual-dtor -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wundef -Winit-self -Wpointer-arith -Wshadow -Wsign-promo -Wuninitialized -Wsuggest-override -Wno-delete-non-virtual-dtor -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -fvisibility-inlines-hidden -g -O0 -DDEBUG -D_DEBUG
β C Compiler: /usr/bin/cc
β C flags (Release): -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -O3 -DNDEBUG -DNDEBUG
β C flags (Debug): -fsigned-char -ffast-math -W -Wall -Wreturn-type -Waddress -Wsequence-point -Wformat -Wformat-security -Wmissing-declarations -Wmissing-prototypes -Wstrict-prototypes -Wundef -Winit-self -Wpointer-arith -Wshadow -Wuninitialized -Wno-comment -Wimplicit-fallthrough=3 -Wno-strict-overflow -fdiagnostics-show-option -Wno-long-long -pthread -fomit-frame-pointer -ffunction-sections -fdata-sections -msse -msse2 -msse3 -fvisibility=hidden -g -O0 -DDEBUG -D_DEBUG
β Linker flags (Release): -Wl,βexclude-libs,libippicv.a -Wl,βexclude-libs,libippiw.a -Wl,βgc-sections -Wl,βas-needed -Wl,βno-undefined
β Linker flags (Debug): -Wl,βexclude-libs,libippicv.a -Wl,βexclude-libs,libippiw.a -Wl,βgc-sections -Wl,βas-needed -Wl,βno-undefined
β ccache: YES
β Precompiled headers: NO
β Extra dependencies: m pthread cudart_static dl rt nppc nppial nppicc nppidei nppif nppig nppim nppist nppisu nppitc npps cublas cudnn cufft -L/usr/lib/x86_64-linux-gnu -L/usr/lib/cuda/lib64
β 3rdparty dependencies:
β OpenCV modules:
β To be built: alphamat aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev datasets dnn dnn_objdetect dnn_superres dpm face features2d flann freetype fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform java line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot python3 quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab wechat_qrcode xfeatures2d ximgproc xobjdetect xphoto
β Disabled: world
β Disabled by dependency: -
β Unavailable: cvv hdf julia matlab ovis python2 sfm viz
β Applications: tests perf_tests apps
β Documentation: NO
β Non-free algorithms: YES
β GUI: GTK3
β GTK+: YES (ver 3.24.33)
β GThread : YES (ver 2.72.4)
β GtkGlExt: NO
β VTK support: NO
β Media I/O:
β ZLib: /usr/lib/x86_64-linux-gnu/libz.so (ver 1.2.11)
β JPEG: /usr/lib/x86_64-linux-gnu/libjpeg.so (ver 80)
β WEBP: build (ver encoder: 0x020f)
β PNG: /usr/lib/x86_64-linux-gnu/libpng.so (ver 1.6.37)
β TIFF: /usr/lib/x86_64-linux-gnu/libtiff.so (ver 42 / 4.3.0)
β JPEG 2000: build (ver 2.5.0)
β OpenEXR: /usr/lib/x86_64-linux-gnu/libImath-2_5.so /usr/lib/x86_64-linux-gnu/libIlmImf-2_5.so /usr/lib/x86_64-linux-gnu/libIex-2_5.so /usr/lib/x86_64-linux-gnu/libHalf-2_5.so /usr/lib/x86_64-linux-gnu/libIlmThread-2_5.so (ver 2_5)
β HDR: YES
β SUNRASTER: YES
β PXM: YES
β PFM: YES
β Video I/O:
β DC1394: YES (2.2.6)
β FFMPEG: YES
β avcodec: YES (58.134.100)
β avformat: YES (58.76.100)
β avutil: YES (56.70.100)
β swscale: YES (5.9.100)
β avresample: NO
β GStreamer: YES (1.20.3)
β v4l/v4l2: YES (linux/videodev2.h)
β Parallel framework: pthreads
β Trace: YES (with Intel ITT)
β Other third-party libraries:
β Intel IPP: 2021.8 [2021.8.0]
β at: /home/neeraj/Applications/OpenCV/opencv/build/3rdparty/ippicv/ippicv_lnx/icv
β Intel IPP IW: sources (2021.8.0)
β at: /home/neeraj/Applications/OpenCV/opencv/build/3rdparty/ippicv/ippicv_lnx/iw
β VA: NO
β Lapack: NO
β Eigen: YES (ver 3.4.0)
β Custom HAL: NO
β Protobuf: build (3.19.1)
β Flatbuffers: builtin/3rdparty (23.5.9)
β NVIDIA CUDA: YES (ver 11.5, CUFFT CUBLAS FAST_MATH)
β NVIDIA GPU arch: 61
β NVIDIA PTX archs:
β cuDNN: YES (ver 8.9.5)
β OpenCL: YES (no extra features)
β Include path: /home/neeraj/Applications/OpenCV/opencv/3rdparty/include/opencl/1.2
β Link libraries: Dynamic load
β Python 3:
β Interpreter: /usr/bin/python3 (ver 3.10.12)
β Libraries: /usr/lib/x86_64-linux-gnu/libpython3.10.so (ver 3.10.12)
β numpy: /usr/local/lib/python3.10/dist-packages/numpy/core/include (ver 1.22.4)
β install path: lib/python3.10/dist-packages/cv2/python-3.10
β Python (for build): /usr/bin/python3
β Java:
β ant: NO
β Java: YES (ver 11.0.20)
β JNI: /usr/lib/jvm/java-8-openjdk-amd64/include /usr/lib/jvm/java-8-openjdk-amd64/include/linux /usr/lib/jvm/java-8-openjdk-amd64/include
β Java wrappers: YES (JAVA)
β Java tests: NO
β Install to: /usr/local
β
β Configuring done (17.4s)
β Generating done (9.6s)
β Build files have been written to: /home/neeraj/Applications/OpenCV/opencv/build
But when I am trying to execute ultralytics/examples/YOLOv8-CPP-Inference. I am getting a warning message. β[ WARN:0@1.107] global net_impl.cpp:174 setUpNet DNN module was not built with CUDA backend; switching to CPUβ.
Am I doing anything wrong?
Please help.
Thanks in advance.
Thanks and regards,
Neeraj Dhekale