Exception thrown when running a sample using dnn


I’m learning to use opencv and trying to run the sample from opencv repo but it always throws an exception. I have no idea how to debug it.

What I tried is to follow this tutorial OpenCV: Load Caffe framework models

and use the exact code from the repo: opencv/classification.cpp at 4.x · opencv/opencv · GitHub

The model/config/classes are downloaded according to the tutorial

download GoogLeNet model files: bvlc_googlenet.prototxt and bvlc_googlenet.caffemodel

Also you need file with names of ILSVRC2012 classes: classification_classes_ILSVRC2012.txt.

I compile it using this command
g++ classification.cpp -o classification -lopencv_core -lopencv_imgproc -lopencv_imgcodecs -lopencv_highgui -lopencv_dnn -lopencv_videoio

and run it like
./classification --model=bvlc_googlenet.caffemodel --config=bvlc_googlenet.prototxt --width=224 --height=224 --classes=classification_classes_ILSVRC2012.txt --mean="104 117 123" --rgb=false --input=space_shuttle.jpg

But when I run it, I always get the exception

$ ./classification --model=bvlc_googlenet.caffemodel --config=bvlc_googlenet.prototxt --width=224 --height=224 --classes=classification_classes_ILSVRC2012.txt  --mean="104 117 123"   --rgb=false --input=space_shuttle.jpg
mean: [104, 117, 123, 0]
std: [0, 0, 0, 0]
Authorization required, but no authorization protocol specified

Authorization required, but no authorization protocol specified

Qt: Session management error: Could not open network socket
terminate called after throwing an instance of 'cv::Exception'
  what():  OpenCV(4.7.0) /home/abuild/rpmbuild/BUILD/opencv-4.7.0/modules/dnn/src/layers/fast_convolution/winograd_3x3s1_f63.cpp:147: error: (-215:Assertion failed) _FX_WINO_IBLOCK == 3 && _FX_WINO_KBLOCK == 4 in function '_fx_winograd_accum_f32'

Aborted (core dumped)

I’m using the library version 4.7.0 from OpenSUSE TumbleWeed. I’m new to OpenCV. And don’t know how to debug OpencV specific application (I know debugging in general). Can anybody help me to understand what’s happening and how to solve it?

Thanks so much.

Qt issue

are you dockering or otherwise virtualizing in any way?

that’d be the problem.

Thanks for your reply. It’s not docker’ed or virtualized. It’s just on my physical machine.

There are two errors but the termination is caused by the exception thrown in the file layers/fast_convolution/winograd_3x3s1_f63.cpp. Why does that call anything in QT?

I comment out the code Mat prob = net.forward() and the code using prob. There is still the same error about Qt but it doesn’t crash.

the qt related problems should go to the suse opencv package maintainer, however, the winograd dnn error might have a parallel here:

in other words, try to workaround with:


Thanks for the pointer. I added that workaround and it didn’t crash now. It showed the result. At least it shows that the space shuttle picture contains a space shuttle.