The sample code is
OpenCV: Detecting colorcheckers using neural network .
I can use version 4.6 to run sample code, but I can’t use version 4.7.
I use cmake and mingw to build opencv on win10, and I use Vscode to run sample code.
I know that version 4.7 can successfully build opencv using cmake and Visual Studio 2019 on win10 and can run the sample code.
Is the difference in build tools causing the problem?
I don’t know what happened? Can you help me?
berak
September 18, 2023, 4:51am
2
please, post TEXT, not images of it, thank you
I get an error about “Exception occurred. Segmentation fault”.
After I try adding “net.enableWinograd(false);”, I can run the sample code.
opened 07:17AM - 03 Jan 23 UTC
closed 07:37PM - 09 Jan 23 UTC
bug
optimization
category: dnn
### System Information
OpenCV version: 4.7.0 from https://github.com/opencv/o… pencv/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()```https://github.com/opencv/opencv/blob/9208dcb07c015e1fda44e40bb07b43c700b4bf46/modules/dnn/src/layers/fast_convolution/fast_convolution.cpp#L420
Wwhen running here finally, an error is reported: the vector is out of range.
https://github.com/opencv/opencv/blob/9208dcb07c015e1fda44e40bb07b43c700b4bf46/modules/dnn/src/layers/fast_convolution/winograd_3x3s1_f63.cpp#L1047
![image](https://user-images.githubusercontent.com/52729998/210313011-b8f04a22-3344-4470-98bc-fd03ec8cadd1.png)
@lioneldaniel told me that it was caused by this PR https://github.com/opencv/opencv/pull/22593, so how to solve this problem?
https://github.com/UNeedCryDear/yolov5-seg-opencv-onnxruntime-cpp/issues/6#issue-1515845995
### Steps to reproduce
test code:
```cpp
#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
- [X] I report the issue, it's not a question
- [X] I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- [X] I updated to the latest OpenCV version and the issue is still there
- [X] There is reproducer code and related data files (videos, images, onnx, etc)
Does Winograd have anything to do with computer equipment? Why can it run if it is set to false?
berak
September 18, 2023, 6:41am
5
ah right. the winograd optimization had some trouble, initially. but updating to latest 4.8.0-dev should fix it