error: (-215:Assertion failed) blob.type() == 5 in function 'populateNet'

asked 2020-02-25 22:39:53 -0600

jambo gravatar image

updated 2020-02-26 03:35:22 -0600

supra56 gravatar image

Python: 3.6.6

Open-CV: 4.2.0-dev (built from source)

Operating System: Raspian 4.19

Torch: 1.1.0

I trained a mobilenet_v2_ssd model (attached) in pytorch and exported to onnx using Pytorch's built in exporter:

learn_eval = learn.model.eval()
dummy_input = torch.randn(1, 3, 480, 480).cuda()
torch_out = torch.onnx_export(learn_eval,
                               dummy_input,
                               model_path+"mobilenet_v2_ssd.onnx",
                               export_params=True)

Here's the traceback:

Traceback (most recent call last):
  File "predict_from_onnx.py", line 28, in <module>
    net = cv2.dnn.readNetFromONNX(args["model"])
cv2.error: OpenCV(4.2.0-dev) /home/pi/opencv_build/opencv/modules/dnn/src/onnx/onnx_importer.cpp:555: error: (-215:Assertion failed) blob.type() == 5 in function 'populateNet'
edit retag flag offensive close merge delete