-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
Opencv cv::dnn::readNetFromONNX throws error #18626
Copy link
Copy link
Closed
Description
OpenCV => 4.2.0
Operating System / Platform => Ubuntu 18.04
Compiler => gcc
Detailed description
When I load the onnx model (converted from pytorch ) using cv::dnn::readNetFromONNX, it throws error:
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.2.0) /home/anilsathyan7/opencv/modules/dnn/src/onnx/onnx_importer.cpp:110: error: (-215:Assertion failed) !tensor_proto.raw_data().empty() || !tensor_proto.float_data().empty() || !tensor_proto.double_data().empty() || !tensor_proto.int64_data().empty() in function 'getMatFromTensor'
Aborted (core dumped)
However i'am able to run the onnx models using onnxruntime inference session and pytorch without any problems. Also i was able to load the mobilenetv2 model using the same setup.
Sample Code:-
//Parameters
String model = "SINet2.onnx";
int backendId = 0; // Auto
int targetId = 0; // CPU
int inpWidth = 320;
int inpHeight = 320;
// Read network
CV_Assert(!model.empty());
Net net = readNetFromONNX(model);//readNet(model, config, framework);
net.setPreferableBackend(backendId);
net.setPreferableTarget(targetId);
Models:
SINet.zip
Reactions are currently unavailable