-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Onnx cannot run with cuda #19929
Copy link
Copy link
Closed
Labels
category: dnncategory: gpu/cuda (contrib)OpenCV 4.0+: moved to opencv_contribOpenCV 4.0+: moved to opencv_contribfeature
Description
Hi, I'm trying to use onnx with opencv
I can use the CPU but not the GPU
it said
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.5.1) /home/ubuntu/opencv-4.5.1/modules/dnn/src/layers/../cuda4dnn/csl/tensor.hpp:210: error: (-215:Assertion failed) start != end in function 'resize'
Here's the code
Init
net_= readNetFromONNX(this->module_path_);
if (use_gpu_ == true) {
net_.setPreferableTarget(DNN_TARGET_CUDA);
net_.setPreferableBackend(DNN_BACKEND_CUDA);
}
recognize
cv::Mat out;
out = Mat(1, 2048, CV_32FC1);
out = 0;
Mat img = origin.clone();
Mat inputBlob = blobFromImage(img, 1, Size(256, 256), Scalar(0, 0, 0), true, false);
net_.setInput(inputBlob);
auto feature_mat = reid_net_.forward();
feature_mat.copyTo(out);
When the use_gpu_ equal false, it can run.
What should I do next,
thx :-)
System information
- OpenCV => 4.5.1
- Operating System / Platform => ubuntu1~18.04 / x86_64
- Compiler => g++ 7.5.0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
category: dnncategory: gpu/cuda (contrib)OpenCV 4.0+: moved to opencv_contribOpenCV 4.0+: moved to opencv_contribfeature