Skip to content

Using onnx model for target detection through OPENCV and C++, the results running through CPU and GPU are inconsistent #24606

@lie12huo

Description

@lie12huo

Describe the feature and motivation

I used Yolov8's onnx model for target detection through C++, and the detection results running through the CPU were correct. When calling net.setPreferableBackend(cv::dnn::DNN_BACKEND_OPENCV) and
net.setPreferableTarget(cv::dnn::DNN_TARGET_CPU) turns on CUDA DNN detection, the data returned by the net.forward() function, the class_id and confidences data are consistent with the CPU operation, but all box data are null.
CPU result:
image

GPU result:
image

The OPENCV version I used is 4.8.1, the CUDA version is 11.8, the CUDNN version is 8.9.6, the graphics card model is NVIDIA GeForce GTX 1660 Ti, and the driver version is 546.17.

In addition, if the model is called directly in Python, the results of running on CPU or GPU will be correct. The same OpenCV, CUDA and DNN versions are used when running in Python and C++.

Additional context

No response

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions