We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
ONNX export from yolov5-seg.pt: https://drive.google.com/file/d/1tV2moQxNfLzNf6yXm5Zev5CVj2o9zuaz/view?usp=share_link
Some wrong happened in runWinograd63()
runWinograd63()
opencv/modules/dnn/src/layers/fast_convolution/fast_convolution.cpp
Line 420 in 9208dcb
opencv/modules/dnn/src/layers/fast_convolution/winograd_3x3s1_f63.cpp
Line 1047 in 9208dcb
@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)
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.
The text was updated successfully, but these errors were encountered:
Hi @UNeedCryDear, I just check your model with 4.7 release. And it works fine on my ARM M1 chip and Ubuntu of X86 platform (with AVX2).
I will try to reproduce the issue in Win10 later.
For short you can try to close the Winograd optimization in your machine by the following code:
net.enableWinograd(false); net.forward(net_output_img, output_layer_names);
Mode details please refer the doc link: https://docs.opencv.org/4.x/db/d30/classcv_1_1dnn_1_1Net.html#a14a87a7604c03ef4ff366672ee9bfcf2
Sorry, something went wrong.
It can run correctly after adding net.enableWinograd(false);
net.enableWinograd(false);
Hi @UNeedCryDear, the patch has been merged. You can try to rebuild OpenCV from scratch to get the speed up of Winograd in your machine.
@zihaomu I confim that the following code works now, thanks!
Line 141 in 65c2d6a
zihaomu
Successfully merging a pull request may close this issue.
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()opencv/modules/dnn/src/layers/fast_convolution/fast_convolution.cpp
Line 420 in 9208dcb
Wwhen running here finally, an error is reported: the vector is out of range.
opencv/modules/dnn/src/layers/fast_convolution/winograd_3x3s1_f63.cpp
Line 1047 in 9208dcb
@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:
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
The text was updated successfully, but these errors were encountered: