OpenCV DNN CUDA Backend Selection Without Compile-Time Backend Support
0 reputation · 28 Jun 2023, 17:09 UTC
OpenCV DNN CUDA Backend Selection Without Compile-Time Backend Support
The goal is to confirm that cv::dnn::Net uses a CUDA backend and target in deployment after setPreferableBackend and setPreferableTarget are called. Inference may fail or run slower than expected without revealing whether GPU acceleration was active.
OpenCV honors a CUDA request only when the library was compiled with the corresponding backend enabled and the deploying user can access the NVIDIA driver, visible devices, and compatible CUDA runtime. Backend compatibility is not strictly validated when the preference is set, so an unsupported combination may appear only during model loading or inference, or cause silent CPU fallback without a warning. Supported backend and target names vary across OpenCV releases and between official packages and custom source builds.
Questions:
- Does OpenCV validate a requested CUDA backend and target at set time, model load, or first inference?
- Which cv::getBuildInformation() fields confirm CUDA backend availability before deployment?
- How can deployment logs distinguish silent CPU fallback from an actual model-loading failure when CUDA is requested?