Home » Python » python – Load ONNX model in opencv2 fails with blob.type() assertion error-Exceptionshub

python – Load ONNX model in opencv2 fails with blob.type() assertion error-Exceptionshub

Posted by: admin February 24, 2020 Leave a comment

Questions:

OS: Raspian GNU/Linux 9
Python: 3.6.6
OpenCV: 4.1.1

When I load an ONNX model in OpenCV DNN I get the following error:

cv2.error: OpenCV(4.1.1)
/home/pi/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp:505:
error: (-215:Assertion failed) blob.type() == 5 in function
‘populateNet’

I’m training a mobilenet_v2 ssd model in PyTorch, then exporting model.eval() to ONNX. onnx.checker.check_model() seems to work. Any ideas?

How to&Answers: