Ask Your Question
0

Error on loading ONNX model

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

comar gravatar image

Hi, I'm trying to rewrite sample code: https://bleedai.com/facial-expression... 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

Comments

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 -0600 )edit

1 answer

Sort by ยป oldest newest most voted
0

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

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

Question Tools

1 follower

Stats

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

Seen: 8,061 times

Last updated: Oct 19 '20