Attention! This forum will be made read-only by Dec-20. Please migrate to Most of existing active users should've received invitation by e-mail.
Ask Your Question

Error on loading ONNX model

asked 2020-10-19 06:05:25 -0500

comar gravatar image

Hi, I'm trying to rewrite sample code: from Python (Jupiter) to C++. Model loading works perfectly in Python (OpenCv v4.4.0), but in C++ it gives me error when parsing ONNX file.

dnn::Net net;

net = dnn::readNetFromONNX("D:/opencv-emotionRecognition/Model/MTCNN/emotion-ferplus-8.onnx");

OpenCV(4.4.0) Error: Unsupported format or combination of formats (Failed to parse onnx model) in cv::dnn::dnn4_v20200609::ONNXImporter::ONNXImporter, file D:\Sviluppo\opencv-4.4.0\modules\dnn\src\onnx\onnx_importer.cpp, line 64

C++ OpenCv is 4.4.0 too. Any suggestion?

edit retag flag offensive close merge delete


that's a fairly well-tested model, part of the opencv model zoo.

check the sha1 of the models used in python / c++. if it's not corrupted, check the path twice again

berak gravatar imageberak ( 2020-10-19 08:21:44 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2020-10-20 10:38:25 -0500

comar gravatar image

Solved! Error on parsing is caused by a path too long (maybe there is a string size limit in readNetFromONNX ). Copying file in a shorter path directory solved the problem. Thank you for your answer!

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2020-10-19 06:05:25 -0500

Seen: 88 times

Last updated: Oct 19