# Opencv4.7 builds successfully, but cannot run the mcc example

**URL:** https://forum.opencv.org/t/opencv4-7-builds-successfully-but-cannot-run-the-mcc-example/14576
**Category:** C++
**Tags:** dnn, build, mcc
**Created:** [September 18, 2023, 3:32am UTC](https://forum.opencv.org/t/opencv4-7-builds-successfully-but-cannot-run-the-mcc-example/14576 "2023-09-18T03:32:40Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![reoskfjd](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@reoskfjd](https://forum.opencv.org/u/reoskfjd)
#### Post date: [September 18, 2023, 3:32am UTC](https://forum.opencv.org/t/opencv4-7-builds-successfully-but-cannot-run-the-mcc-example/14576/1 "2023-09-18T03:32:40Z")

</div>

The sample code is  
[OpenCV: Detecting colorcheckers using neural network](https://docs.opencv.org/4.x/d4/dc0/tutorial_mcc_chart_detection_enhanced_by_neural_network.html).  
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?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/opencv/original/2X/7/763c71f6300a7e6ceffcd9e533d3cf7729d5577a.png)

---

<div class="post-metadata">

### Author: ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)
#### Post date: [September 18, 2023, 4:51am UTC](https://forum.opencv.org/t/opencv4-7-builds-successfully-but-cannot-run-the-mcc-example/14576/2 "2023-09-18T04:51:47Z")

</div>

please, post TEXT, not images of it, thank you

---

<div class="post-metadata">

### Author: ![reoskfjd](https://avatars.discourse-cdn.com/v4/letter/r/bbe5ce/32.png) [@reoskfjd](https://forum.opencv.org/u/reoskfjd)
#### Post date: [September 18, 2023, 5:20am UTC](https://forum.opencv.org/t/opencv4-7-builds-successfully-but-cannot-run-the-mcc-example/14576/4 "2023-09-18T05:20:22Z")

</div>

I get an error about “Exception occurred. Segmentation fault”.  
After I try adding “net.enableWinograd(false);”, I can run the sample code.

> <https://github.com/opencv/opencv/issues/23080>
>
> \### 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?

---

<div class="post-metadata">

### Author: ![berak](https://avatars.discourse-cdn.com/v4/letter/b/85f322/32.png) [@berak](https://forum.opencv.org/u/berak)
#### Post date: [September 18, 2023, 6:41am UTC](https://forum.opencv.org/t/opencv4-7-builds-successfully-but-cannot-run-the-mcc-example/14576/5 "2023-09-18T06:41:52Z")

</div>

> [@reoskfjd](#):
>
> After I try adding “net.enableWinograd(false);”, I can run the sample code.
> 
> [Segmentation fault for cv::dnn::readNetFromONNX.forward() · Issue #23080 · opencv/opencv · GitHub](https://github.com/opencv/opencv/issues/23080)

ah right. the winograd optimization had some trouble, initially. but updating to latest 4.8.0-dev should fix it
