-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Segmentation fault for cv::dnn::readNetFromONNX.forward() #23080
Copy link
Copy link
Closed
Description
System Information
OpenCV version: 4.7.0 from https://github.com/opencv/opencv/archive/refs/tags/4.7.0.zip
Operating System / Platform: Win10 22H2
Compiler & compiler version:VS2019 -MSVC14.2
Detailed description
ONNX export from yolov5-seg.pt:
https://drive.google.com/file/d/1tV2moQxNfLzNf6yXm5Zev5CVj2o9zuaz/view?usp=share_link
Some wrong happened in runWinograd63()
| if (runWinograd63(input, fusedAddMat, output, conv, ntasks, minval, maxval, activ, ifMinMaxAct)) |
Wwhen running here finally, an error is reported: the vector is out of range.
| parallel_for_(Range(0, ntasks), [&](const Range& r0) { |
@lioneldaniel told me that it was caused by this PR #22593, so how to solve this problem?
UNeedCryDear/yolov5-seg-opencv-onnxruntime-cpp#6 (comment)
Steps to reproduce
test code:
#include <iostream>
#include <opencv2/opencv.hpp>
using namespace cv;
using namespace std;
string model_path = "./yolov5s-seg.onnx";
Net net=readNetFromONNX(model_path );
net.setPreferableBackend(cv::dnn::DNN_BACKEND_DEFAULT);
net.setPreferableTarget(cv::dnn::DNN_TARGET_CPU);
Mat test_img=Mat::zeros(Size(640,640),CV_8UC3);
Mat blob;
blobFromImage(test_img, blob, 1 / 255.0, cv::Size(640, 640), cv::Scalar(0, 0, 0), true, false);
net.setInput(blob);
vector<string> output_layer_names{ "output0","output1" };
net.forward(net_output_img, output_layer_names);
...
The above code can run correctly in versions 4.5.0~4.6.0, but an error occurred in 4.7.0.
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable