Opencv + cuda + yolov5-v6.0

System information (version)

  • OpenCV => : 4.5.1
  • cuda => : 10.2
  • cudnn => : 8.2
  • Operating System / Platform => : Windows 64 Bit
  • Compiler => : Visual Studio 2019

Detailed description

I compiled the Debug and Release versions of opencv4.5.1+cuda, and used dnn for detection.

  • Debug library: test cuda detection and cpu detection, the results are correct;

  • Release library: the result of the cuda detection is correct, the result of the cpu detection is abnormal, and the detection result is basically not obtained.

  • I tried vs2017+opencv4.5.1, vs2019+opencv4.5.4, the situation is the same.

what is the reason?

please explain that a bit more. if you have example data and expected results, please add those to your question

-net.setPreferableBackend(cv::dnn::DNN_BACKEND_CUDA);
-net.setPreferableTarget(cv::dnn::DNN_TARGET_CUDA);

-net.setPreferableBackend(cv::dnn::DNN_BACKEND_OPENCV);|
-net.setPreferableTarget(cv::dnn::DNN_TARGET_CPU);|