gpt4 book ai didi

c++ - 在打开 cuda 后端的情况下配置 OpenCV cmake 构建时出现错误 "CUDA backend requires cuDNN"

转载 作者:行者123 更新时间:2023-12-04 11:14:19 27 4
gpt4 key购买 nike

我的目标:
我的目标是配置一个支持 cuda、tesseract 和 QT 的 OpenCV 4.5.1-dev 版本,而没有任何 cmake 错误..
我遇到的问题:
当我按下 cmake gui 上的配置按钮时,出现以下错误:

CMake Error at modules/dnn/CMakeLists.txt:39 (message):
DNN: CUDA backend requires cuDNN. Please resolve dependency or disable
OPENCV_DNN_CUDA=OFF
这是我收到的完整 cmake 日志消息:
Selecting Windows SDK version 10.0.19041.0 to target Windows 10.0.19042.
Detected processor: AMD64
libjpeg-turbo: VERSION = 2.0.6, BUILD = opencv-4.5.1-dev-libjpeg-turbo
Could NOT find OpenJPEG (minimal suitable version: 2.0, recommended version >= 2.3.1). OpenJPEG will be built from sources
OpenJPEG: VERSION = 2.3.1, BUILD = opencv-4.5.1-dev-openjp2-2.3.1
OpenJPEG libraries will be built from sources: libopenjp2 (version "2.3.1")
found Intel IPP (ICV version): 2020.0.0 [2020.0.0 Gold]
at: C:/Users/ASD/Project/cplusplus/lib/opencv-master/build/3rdparty/ippicv/ippicv_win/icv
found Intel IPP Integration Wrappers sources: 2020.0.0
at: C:/Users/ASD/Project/cplusplus/lib/opencv-master/build/3rdparty/ippicv/ippicv_win/iw
Could NOT find CUDNN (missing: CUDNN_LIBRARY CUDNN_INCLUDE_DIR) (Required is at least version "7.5")
CUDA detected: 11.2
CUDA: Using CUDA_ARCH_BIN=6.1
CUDA NVCC target flags: -gencode;arch=compute_61,code=sm_61;-D_FORCE_INLINES
CUDA: MSVS generator is detected. Disabling CMake re-run checks (CMAKE_SUPPRESS_REGENERATION=ON). You need to run CMake manually if updates are required.
Could not find OpenBLAS include. Turning OpenBLAS_FOUND off
Could not find OpenBLAS lib. Turning OpenBLAS_FOUND off
Could NOT find BLAS (missing: BLAS_LIBRARIES)
Could NOT find LAPACK (missing: LAPACK_LIBRARIES)
Reason given by package: LAPACK could not be found because dependency BLAS could not be found.

VTK is not found. Please set -DVTK_DIR in CMake to VTK build directory, or to VTK install subdirectory with VTKConfig.cmake file
OpenCV Python: during development append to PYTHONPATH: C:/Users/ASD/Project/cplusplus/lib/opencv-master/build/python_loader
Module opencv_alphamat disabled because the following dependencies are not found: Eigen
Caffe: NO
Protobuf: NO
Glog: NO
freetype2: NO
harfbuzz: NO
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: Eigen Glog/Gflags
Tesseract: NO
Allocator metrics storage type: 'long long'
CMake Error at modules/dnn/CMakeLists.txt:39 (message):
DNN: CUDA backend requires cuDNN. Please resolve dependency or disable
OPENCV_DNN_CUDA=OFF


Registering hook 'INIT_MODULE_SOURCES_opencv_dnn': C:/Users/ASD/Project/cplusplus/lib/opencv-master/modules/dnn/cmake/hooks/INIT_MODULE_SOURCES_opencv_dnn.cmake
opencv_dnn: filter out cuda4dnn source code
rgbd: CERES support is disabled. Ceres Solver is Required for Posegraph optimization

General configuration for OpenCV 4.5.1-dev =====================================
Version control: unknown

Extra modules:
Location (extra): C:/Users/ASD/Project/cplusplus/lib/opencv_contrib-master/modules
Version control (extra): unknown

Platform:
Timestamp: 2021-01-20T14:05:20Z
Host: Windows 10.0.19042 AMD64
CMake: 3.19.1
CMake generator: Visual Studio 16 2019
CMake build tool: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/MSBuild/Current/Bin/MSBuild.exe
MSVC: 1928
Configuration: Debug 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 (17 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 (5 files): + SSSE3 SSE4_1 POPCNT SSE4_2 AVX
AVX2 (31 files): + SSSE3 SSE4_1 POPCNT SSE4_2 FP16 FMA3 AVX AVX2
AVX512_SKX (7 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: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe (ver 19.28.29336.0)
C++ flags (Release): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP /MD /O2 /Ob2 /DNDEBUG
C++ flags (Debug): /DWIN32 /D_WINDOWS /W4 /GR /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /MP /MDd /Zi /Ob0 /Od /RTC1
C Compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.28.29333/bin/Hostx64/x64/cl.exe
C flags (Release): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /MD /O2 /Ob2 /DNDEBUG
C flags (Debug): /DWIN32 /D_WINDOWS /W3 /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi /fp:precise /MP /MDd /Zi /Ob0 /Od /RTC1
Linker flags (Release): /machine:x64 /INCREMENTAL:NO
Linker flags (Debug): /machine:x64 /debug /INCREMENTAL
ccache: NO
Precompiled headers: YES
Extra dependencies: cudart_static.lib nppc.lib nppial.lib nppicc.lib nppidei.lib nppif.lib nppig.lib nppim.lib nppist.lib nppisu.lib nppitc.lib npps.lib cublas.lib cufft.lib -LIBPATH:C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2/lib/x64
3rdparty dependencies:

OpenCV modules:
To be built: aruco bgsegm bioinspired calib3d ccalib core cudaarithm cudabgsegm cudacodec cudafeatures2d cudafilters cudaimgproc cudalegacy cudaobjdetect cudaoptflow cudastereo cudawarping cudev cvv datasets dnn dnn_objdetect dnn_superres dpm face features2d flann fuzzy gapi hfs highgui img_hash imgcodecs imgproc intensity_transform line_descriptor mcc ml objdetect optflow phase_unwrapping photo plot quality rapid reg rgbd saliency shape stereo stitching structured_light superres surface_matching text tracking ts video videoio videostab xfeatures2d ximgproc xobjdetect xphoto
Disabled: world
Disabled by dependency: -
Unavailable: alphamat cnn_3dobj freetype hdf java julia matlab ovis python2 python3 sfm viz
Applications: tests perf_tests apps
Documentation: NO
Non-free algorithms: YES

Windows RT support: NO

GUI:
QT: YES (ver 5.15.2)
QT OpenGL support: NO
Win32 UI: YES
VTK support: NO

Media I/O:
ZLib: build (ver 1.2.11)
JPEG: build-libjpeg-turbo (ver 2.0.6-62)
WEBP: build (ver encoder: 0x020f)
PNG: build (ver 1.6.37)
TIFF: build (ver 42 - 4.0.10)
JPEG 2000: build (ver 2.3.1)
OpenEXR: build (ver 2.3.0)
HDR: YES
SUNRASTER: YES
PXM: YES
PFM: YES

Video I/O:
DC1394: NO
FFMPEG: YES (prebuilt binaries)
avcodec: YES (58.91.100)
avformat: YES (58.45.100)
avutil: YES (56.51.100)
swscale: YES (5.7.100)
avresample: YES (4.0.0)
GStreamer: NO
DirectShow: YES
Media Foundation: YES
DXVA: YES

Parallel framework: Concurrency

Trace: YES (with Intel ITT)

Other third-party libraries:
Intel IPP: 2020.0.0 Gold [2020.0.0]
at: C:/Users/ASD/Project/cplusplus/lib/opencv-master/build/3rdparty/ippicv/ippicv_win/icv
Intel IPP IW: sources (2020.0.0)
at: C:/Users/ASD/Project/cplusplus/lib/opencv-master/build/3rdparty/ippicv/ippicv_win/iw
Lapack: NO
Eigen: NO
Custom HAL: NO
Protobuf: build (3.5.1)

NVIDIA CUDA: YES (ver 11.2, CUFFT CUBLAS)
NVIDIA GPU arch: 61
NVIDIA PTX archs:

cuDNN: NO

OpenCL: YES (NVD3D11)
Include path: C:/Users/ASD/Project/cplusplus/lib/opencv-master/3rdparty/include/opencl/1.2
Link libraries: Dynamic load

Python (for build): C:/Python27/python.exe

Java:
ant: NO
JNI: C:/Program Files/OpenJDK/openjdk-11.0.9_11/include C:/Program Files/OpenJDK/openjdk-11.0.9_11/include/win32 C:/Program Files/OpenJDK/openjdk-11.0.9_11/include
Java wrappers: NO
Java tests: NO

Install to: C:/Users/ASD/Project/cplusplus/lib/opencv-master/build/install
-----------------------------------------------------------------

Configuring incomplete, errors occurred!
See also "C:/Users/ASD/Project/cplusplus/lib/opencv-master/build/CMakeFiles/CMakeOutput.log".
See also "C:/Users/ASD/Project/cplusplus/lib/opencv-master/build/CMakeFiles/CMakeError.log".
我期待的是能够配置 cmake 构建
没有任何cmake错误。
可帮助您重现问题的信息:
  • 这是我安装的 nvcc 版本:
  • nvcc: NVIDIA (R) Cuda compiler driver
    Copyright (c) 2005-2020 NVIDIA Corporation
    Built on Mon_Nov_30_19:15:10_Pacific_Standard_Time_2020
    Cuda compilation tools, release 11.2, V11.2.67
    Build cuda_11.2.r11.2/compiler.29373293_0
  • 这是我的 cmake 构建配置:
    Cmake build configuration
    我使用visual studio 2019
  • 配置了cmake gui来编译opencv
  • 我要搭建OpenCV 4.5.1-dev的open cv版本
  • 我使用的 cmake 版本是 3.19.1
  • 这是我拥有的有关 Visual Studio 版本的信息
    已安装:
  • Microsoft Visual Studio Community 2019
    Version 16.8.4
    VisualStudio.16.Release/16.8.4+30907.101
    Microsoft .NET Framework
    Version 4.8.04084

    Installed Version: Community

    Visual C++ 2019 00435-60000-00000-AA180
    Microsoft Visual C++ 2019

    ASP.NET and Web Tools 2019 16.8.557.25636
    ASP.NET and Web Tools 2019

    Azure App Service Tools v3.0.0 16.8.557.25636
    Azure App Service Tools v3.0.0

    C# Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    ClangFormat 1.0
    Formats code by calling the clang-format executable.

    Common Azure Tools 1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.

    Discord RPC for Visual Studio 1.0
    A Discord Rich Presence extension for Visual Studio 2017 and 2019.

    Extensibility Message Bus 1.2.6 (master@34d6af2)
    Provides common messaging-based MEF services for loosely coupled Visual Studio extension components communication and integration.

    Image Watch 1.0


    IntelliCode Extension 1.0
    IntelliCode Visual Studio Extension Detailed Info

    Microsoft Azure Tools 2.9
    Microsoft Azure Tools for Microsoft Visual Studio 2019 - v2.9.30701.1

    Microsoft JVM Debugger 1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines

    Microsoft MI-Based Debugger 1.0
    Provides support for connecting Visual Studio to MI compatible debuggers

    Microsoft Visual C++ Wizards 1.0
    Microsoft Visual C++ Wizards

    Microsoft Visual Studio VC Package 1.0
    Microsoft Visual Studio VC Package

    Mono Debugging for Visual Studio 16.8.43 (00471f8)
    Support for debugging Mono processes with Visual Studio.

    Node.js Tools 1.5.20902.1 Commit Hash:b474efcb6f92db52a8f8e2e6a8cb9648476885cc
    Adds support for developing and debugging Node.js apps in Visual Studio

    NuGet Package Manager 5.8.1
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/

    NVIDIA CUDA 11.2 Wizards 11.2
    Wizards to create new NVIDIA CUDA projects and source files.

    NVIDIA Nsight Visual Studio Edition 2020.3.0.20315
    NVIDIA Nsight Visual Studio Edition provides tools for GPGPU and graphics development. Copyright © NVIDIA 2010 - 2020.
    •Direct3D® and DirectX® are registered trademarks of Microsoft Corporation in the United States and/or other countries.
    •Microsoft Detours is used under the Professional license (http://research.microsoft.com/en-us/projects/detours/).
    •Gardens Point Parser Generator Copyright 2005 Queensland University of Technology (QUT). All rights reserved.
    •Icons from Axialis Software used under the licensing terms found here: www.axialis.com
    •NLog Copyright © 2004-2006 Jaroslaw Kowalski (jaak@jkowalski.net)
    •zlib and libpng used under the zlib/libpnc license (http://opensource.org/licenses/Zlib)
    •Breakpad Copyright ©2006, Google Inc. All rights reserved.
    •The OpenGL Extension Wrangler Library
    Copyright ©2008-2016, Nigel Stewart (nigels@users.sourceforge.net), Copyright ©2002-2008, Milan Ikits (milan.ikits@ieee.org), Copyright ©2002-2008, Marcelo E. Magallon (mmagallo@debian.org), Copyright ©2002, Lev Povalahev.
    All rights reserved.
    •LIBSSH2 Copyright ©2004-2007 Sara Golemon (sarag@libssh2.org), Copyright ©2005,2006 Mikhail Gusarov (dottedmag@dottedmag.net),Copyright ©2006-2007 The Written Word, Inc.,Copyright ©2007 Eli Fant (elifantu@mail.ru),Copyright ©2009-2014 Daniel Stenberg., Copyright ©2008, 2009 Simon Josefsson.
    All rights reserved.
    •Protobuf Copyright ©2014, Google Inc. All rights reserved.
    •xxHASH Library Copyright ©2012-2014, Yann Collet. All rights reserved.
    •FMT Copyright ©2012 - 2016, Victor Zverovich
    •Font Awesome Copyright 2018 Fonticons, Inc.
    •ELF Definitions Copyright (c) 2010 Joseph Koshy, All rights reserved.

    Warning: This computer program is protected by copyright law and international treaties. Unauthorized reproduction or distribution of this program, or any portion of it, may result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law.

    NVIDIA Nsight Visual Studio Edition - CUDA support 2020.3.0.20315
    NVIDIA Nsight Visual Studio Edition - CUDA support provides tools for CUDA development and debugging.

    ProjectServicesPackage Extension 1.0
    ProjectServicesPackage Visual Studio Extension Detailed Info

    Python - VC Project Support 16.1.19129.1
    Provides support for launching C++ projects with Python debugging enabled.

    Qt Visual Studio Tools 2.6.0.7
    The Qt Visual Studio Tools allow developers to use the standard development environment without having to worry about any Qt-related build steps or tools.

    Stack Overflow Quick Launch Search Provider 1.0.1
    Stack Overflow search provider for Visual Studio's Quick Launch

    Start Page+ 1.0.1
    Bring back Start Page! (a document tab, NOT a modal window)

    Syntax Highlighting Pack 2.8.134
    Adds syntax highlighting and snippet support for a wide variety of programming languages such as Clojure, Go, Jade, Lua, Swift, Ruby and many more...

    Test Adapter for Boost.Test 1.0
    Enables Visual Studio's testing tools with unit tests written for Boost.Test. The use terms and Third Party Notices are available in the extension installation directory.

    Test Adapter for Google Test 1.0
    Enables Visual Studio's testing tools with unit tests written for Google Test. The use terms and Third Party Notices are available in the extension installation directory.

    Text Sharp 2.3.0
    Visual Studio IDE text clarity tuner. An easy way to turn off ClearType.

    TypeScript Tools 16.0.21016.2001
    TypeScript Tools for Microsoft Visual Studio

    Visual Basic Tools 3.8.0-5.20604.10+9ed4b774d20940880de8df1ca8b07508aa01c8cd
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.

    Visual F# Tools 16.8.0-beta.20507.4+da6be68280c89131cdba2045525b80890401defd
    Microsoft Visual F# Tools

    Visual Studio Code Debug Adapter Host Package 1.0
    Interop layer for hosting Visual Studio Code debug adapters in Visual Studio

    Visual Studio Tools for CMake 1.0
    Visual Studio Tools for CMake

    VisualStudio.DeviceLog 1.0
    Information about my package

    VisualStudio.Foo 1.0
    Information about my package

    VisualStudio.Mac 1.0
    Mac Extension for Visual Studio

    VSColorOutput 2.73
    Color output for build and debug windows - https://mike-ward.net/vscoloroutput

    Xamarin 16.8.000.261 (d16-8@bb99248)
    Visual Studio extension to enable development for Xamarin.iOS and Xamarin.Android.

    Xamarin Designer 16.8.0.507 (remotes/origin/d16-8@e87b24884)
    Visual Studio extension to enable Xamarin Designer tools in Visual Studio.

    Xamarin Templates 16.8.112 (86385a3)
    Templates for building iOS, Android, and Windows apps with Xamarin and Xamarin.Forms.

    Xamarin.Android SDK 11.1.0.26 (d16-8/a36ce73)
    Xamarin.Android Reference Assemblies and MSBuild support.
    Mono: 5e9cb6d
    Java.Interop: xamarin/java.interop/d16-8@79d9533
    ProGuard: Guardsquare/proguard/proguard6.2.2@ebe9000
    SQLite: xamarin/sqlite/3.32.1@1a3276b
    Xamarin.Android Tools: xamarin/xamarin-android-tools/d16-8@2fb1cbc


    Xamarin.iOS and Xamarin.Mac SDK 14.8.0.3 (c51fabee8)
    Xamarin.iOS and Xamarin.Mac Reference Assemblies and MSBuild support.
  • 我的 GPU 是带有 2GB 显存的 nvidia gtx 1050 移动设备
  • 这是我的 cmake 更改:
  • Commandline options:
    -DBUILD_CUDA_STUBS:BOOL="1" -DBUILD_opencv_bgsegm:BOOL="1" -DCUDA_USE_STATIC_CUDA_RUNTIME:BOOL="1" -DCUDA_GENERATION:STRING="" -DANT_EXECUTABLE:FILEPATH="ANT_EXECUTABLE-NOTFOUND" -DCUDA_ARCH_BIN:STRING="6.1" -DWITH_CUDNN:BOOL="0" -DTesseract_LIBRARY:FILEPATH="C:/Users/ASD/Project/cplusplus/lib/tesseract-master/build/bin/RelWithDebInfo/text2image.lib" -DCUDA_ARCH_PTX:STRING="" -DTesseract_DIR:PATH="Tesseract_DIR-NOTFOUND" -DWITH_FREETYPE:BOOL="1" -DCUDA_TOOLKIT_ROOT_DIR:PATH="C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2" -DBUILD_opencv_world:BOOL="1"


    Cache file:
    BUILD_CUDA_STUBS:BOOL=1
    BUILD_opencv_bgsegm:BOOL=1
    CUDA_USE_STATIC_CUDA_RUNTIME:BOOL=1
    CUDA_GENERATION:STRING=
    ANT_EXECUTABLE:FILEPATH=ANT_EXECUTABLE-NOTFOUND
    CUDA_ARCH_BIN:STRING=6.1
    WITH_CUDNN:BOOL=0
    Tesseract_LIBRARY:FILEPATH=C:/Users/ASD/Project/cplusplus/lib/tesseract-master/build/bin/RelWithDebInfo/text2image.lib
    CUDA_ARCH_PTX:STRING=
    Tesseract_DIR:PATH=Tesseract_DIR-NOTFOUND
    WITH_FREETYPE:BOOL=1
    CUDA_TOOLKIT_ROOT_DIR:PATH=C:/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v11.2
    BUILD_opencv_world:BOOL=1
    尝试解决问题
    错误:CUDA 后端需要 cuDNN。请解决依赖或禁用
    尝试解决问题:
  • 指定 Cmake 选项 CUDA_ARCH_BIN什么版本的cuda
    软件开发工具包(11.2)。我认为标志是关于 cuda dnn 版本
  • 指定 cmake 选项 CUDA_ARCH_PTX到我的 GPU 计算能力(版本),因为我认为它是关于 Compute capability (version) .根据 this wikipedia article,我知道我的计算能力是多少
  • 我尝试按照在此线程中找到的 AbdelAziz AbdelLatef 的说明进行操作:
    How to deal with "DNN module was not built with CUDA backend; switching to CPU" warning in C++?但是它没有帮助,因为已经启用了 cmake 标志并且我已经将 opencv contrib 添加到我的 cmake 配置
  • 我尝试将 CUDA_ARCH_BIN 标志指定为 6.1喜欢 this issuecomment
    关于 opencv 问题,就像我指出的那样。听完他的话,
    说我仍然有错误。
  • 最佳答案

    我在执行这样的 cmake 命令时收到了同样的错误
    问题是,OpenCV 期待 WITH_CUDNN 设置为 开启 而它是 关闭 .

    sudo cmake -D CMAKE_BUILD_TYPE=RELEASE \
    -D CMAKE_INSTALL_PREFIX=/usr/local \
    -D INSTALL_PYTHON_EXAMPLES=OFF \
    -D INSTALL_C_EXAMPLES=OFF \
    -D OPENCV_ENABLE_NONFREE=ON \
    -D WITH_CUDA=ON \
    -D WITH_CUDNN=OFF \ ### This is the switch I had to flip to get it working!
    -D OPENCV_DNN_CUDA=ON \
    -D ENABLE_FAST_MATH=1
    -D CUDA_FAST_MATH=1 \
    -D CUDA_ARCH_BIN=10.2 \
    -D WITH_CUBLAS=1 \
    -D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib/modules \
    -D HAVE_opencv_python3=ON \
    -D PYTHON_EXECUTABLE=~/virtualenvs/opencv_cuda/bin/python/ \
    -D BUILD_EXAMPLES=OFF ..
    我收到了与您一样的确切错误:
    CMake Error at modules/dnn/CMakeLists.txt:39 (message):
    DNN: CUDA backend requires cuDNN. Please resolve dependency or disable
    OPENCV_DNN_CUDA=OFF
    所以代替 -D WITH_CUDNN=OFF我用过 -D WITH_CUDNN=ON当使用 cmake 进行配置并使用 make -j$(nproc) 进行编译时,它就像一个魅力。

    关于c++ - 在打开 cuda 后端的情况下配置 OpenCV cmake 构建时出现错误 "CUDA backend requires cuDNN",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65813328/

    27 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com