RobustVideoMatting icon indicating copy to clipboard operation
RobustVideoMatting copied to clipboard

Open prettrained onnx with OpenCV C++

Open FrankEscobar opened this issue 2 years ago • 4 comments

This is my first time with ONNX models and I’m not sure if I’m having a newbie problem so sorry in advance!

I’ve just tried to load a couple of models and I have the same assert always:


[ERROR:[email protected]] global onnx_importer.cpp:1054 cv::dnn::dnn4_v20221220::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 3 inputs and 1 outputs: [Concat]:(onnx_node!Concat_2) from domain='ai.onnx'
OpenCV: terminate handler is called! The last OpenCV error is:
OpenCV(4.7.0-dev) Error: Unspecified error (> Node [[email protected]]:(onnx_node!Concat_2) parse error: OpenCV(4.7.0-dev) C:\GHA-OCV-2\_work\ci-gha-workflow\ci-gha-workflow\opencv\modules\dnn\src\layers\concat_layer.cpp:105: error: (-215:Assertion failed) curShape.size() == outputs[0].size() in function 'cv::dnn::ConcatLayerImpl::getMemoryShapes'
> ) in cv::dnn::dnn4_v20221220::ONNXImporter::handleNode, file C:\GHA-OCV-2\_work\ci-gha-workflow\ci-gha-workflow\opencv\modules\dnn\src\onnx\onnx_importer.cpp, line 1073

and they are “rvm_resnet50_fp32.onnx” and “rvm_mobilenetv3_fp32.onnx”

Obviously I’m loading them with robustNN = cv::dnn::readNetFromONNX(robustNNPath);

Thank you in advance for any tip

FrankEscobar avatar Jan 07 '23 11:01 FrankEscobar

use ONNXRuntime

PeterL1n avatar Jan 07 '23 16:01 PeterL1n

The nice thing about using OpenCV is that it has some built-in features like reading the webcam and so

FrankEscobar avatar Jan 07 '23 17:01 FrankEscobar

I am running to the same issues. Any luck reading the pretrained ONNX models in C++ using openCV?

npourian avatar Feb 23 '23 17:02 npourian

The nice thing about using OpenCV is that it has some built-in features like reading the webcam and so

You can use onnxruntime and opencv together

VladMVLX avatar Jul 14 '23 18:07 VladMVLX