-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
cv::dnn::readNetFromONNX load model failed #15251
Copy link
Copy link
Closed
Labels
Description
OpenCV => 4.1.1
Operating System / Platform => centos x86_64
Compiler => gcc
Detailed description
When I load the onnx model (converted from pytorch ) using cv::dnn::readNetFromONNX, it will get the "terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.1.1) /opt/notebook_files/usefull/opencv-4.1.1/modules/dnn/src/layers/permute_layer.cpp:124: error: (-215:Assertion failed) inputs.size() > 0 in function 'getMemoryShapes'"
pytorch model:
https://github.com/xinyi61/xinyi61.github.TEST/blob/master/MobileFace_Net
convert to onnx script:
model = MobileFaceNet(512).to(config.DEVICES)
model.load_state_dict(torch.load("MobileFace_Net",
map_location=lambda storage, loc: storage))
model.eval()
example = torch.rand(1, 3, 112, 112, requires_grad=True).to(config.DEVICES)
torch_out = torch.onnx._export(model,
example,
"mobileface_model_final.onnx",
export_params=True)
converted onnx model:
https://github.com/xinyi61/xinyi61.github.TEST/blob/master/mobileface_model_final.onnx
Reactions are currently unavailable