Ask Your Question
0

Strange error in getMemoryShapes function

asked 2019-02-24 16:27:22 -0600

r3krut gravatar image

updated 2019-02-25 01:46:59 -0600

berak gravatar image

Hello everyone! Currently, I'm try to solve the object detection task. The model in used is MobileNetV1 + SSD from https://github.com/qfgaohao/pytorch-s..., The code was written in PyTorch framework. In order to use this model in OpenvCV library I converted it to ONNX representation by the standard torch.onnx module. But when I'm try to read this .onnx file I get the next error: cv2.error: OpenCV(4.0.1-dev) /home/user/opencv/modules/dnn/src/layers/slice_layer.cpp:129: error: (-215:Assertion failed) inputs.size() == 1 in function 'getMemoryShapes'

I'd like to note that when I'm cnonvert only MobileNetV1 in ONNX representation and read it through the dnn.readNetFromONNX(net) I don't get the above error. All works well.

What am I doing wrong?

edit retag flag offensive close merge delete

Comments

1

Could you please add a model file?

dkurt gravatar imagedkurt ( 2019-02-25 01:13:43 -0600 )edit
1

@dkurt yes, of course. Here the graph of the model(MobileNetV1 + SSD) and his .onnx file. https://drive.google.com/drive/folder...

r3krut gravatar imager3krut ( 2019-02-25 04:22:46 -0600 )edit
1

Model input is batch with size (1, 3, 300, 300)

r3krut gravatar imager3krut ( 2019-02-25 04:26:10 -0600 )edit

2 answers

Sort by ยป oldest newest most voted
1

answered 2019-05-25 09:19:29 -0600

datascientist gravatar image

I got the same error in 4.0, 4.1 and the master builds, while trying to import resnet50.onnx, which is the result of onnx export of the existing pretrained resnet50 PyTorch model. You can generate the model using this code.

import torch, torchvision

dummy_input = torch.randn(1, 3, 224, 224)

model = torchvision.models.resnet50(pretrained=True)

torch.onnx.export(model, dummy_input, "resnet50.onnx")

edit flag offensive delete link more
0

answered 2019-04-15 04:06:36 -0600

zheng lilei gravatar image

Same error observed.

edit flag offensive delete link more

Comments

https://drive.google.com/drive/folder... Link to the model, which is quite similar to r3krut's

zheng lilei gravatar imagezheng lilei ( 2019-04-15 22:15:02 -0600 )edit

Question Tools

2 followers

Stats

Asked: 2019-02-24 16:15:30 -0600

Seen: 1,303 times

Last updated: May 25 '19