Impossible to import .onnx with importONNXLayers

8 ビュー (過去 30 日間)
tesarj13
tesarj13 2018 年 10 月 21 日
コメント済み: Mahmoud Safian 2020 年 2 月 9 日

I am trying to import different onnx models from official repo. importONNXLayers always ends with error:

  • ArcFace throws: Error using importONNXLayers (line 39) Size vector must have at least two elements.
  • SqueezeNet throws: Error using importONNXLayers (line 39) Node 'squeezenet0_flatten0_reshape0': The Reshape operator is supported only when it performs a flattening operation.
  • Emotion FerPlus throws: Error using importONNXLayers (line 39) Node 'Times622_reshape1': The Reshape operator is supported only when it performs a flattening operation.

I followed official documentation for using importONNXLayers function:

 layers = importONNXLayers('squeezenet1.1.onnx','OutputLayerType','classification');

What is wrong here?

  2 件のコメント
Kevin Chng
Kevin Chng 2018 年 10 月 21 日
Hi, I have encountered this problem with different error after downloading the support package.
modelfile = 'cifarResNet.onnx';
classes = ["airplane" "automobile" "bird" "cat" "dee" "dog" "frog" "horse" "ship" "truck"];
net = importONNXNetwork(modelfile,'OutputLayerType','classification','Classes',classes)
Error using onnxmex
Opening file 'cifarResNet.onnx' failed.
Error in nnet.internal.cnn.onnx.ModelProto (line 31)
ModelPtr = onnxmex(int32(FuncName.EdeserializeFromFile), filename);
Error in nnet.internal.cnn.onnx.importONNXNetwork (line 8)
m = nnet.internal.cnn.onnx.ModelProto(Filename);
Error in importONNXNetwork (line 53)
Network = nnet.internal.cnn.onnx.importONNXNetwork(ModelFile, varargin{:});
I don't understand as well. Are you able to run the code above?
tesarj13
tesarj13 2018 年 10 月 21 日
I downloaded resnet50v2.onnx from repo ( where am I supposed to get the 'cifarResNet.onnx' file anyway?) and error on line 39 is: Node 'resnetv24_flatten0_reshape0': The Reshape operator is supported only when it performs a flattening operation.
Also there are two almost same functions: importONNXNetwork and importONNXLayers. Both throw same errors..

サインインしてコメントする。

回答 (2 件)

Don Mathis
Don Mathis 2018 年 10 月 26 日
Those ONNX models are somewhat unusual in their use of the Reshape operator. We are actively working on supporting more ONNX operators, and we specifically aim to be able to import models in the ONNX model zoo.
  2 件のコメント
tesarj13
tesarj13 2018 年 10 月 26 日
Glad to hear that ! Thanks !
Mahmoud Safian
Mahmoud Safian 2020 年 2 月 9 日
did you solve this problem in MATLAB 2019b ??

サインインしてコメントする。


cui,xingxing
cui,xingxing 2019 年 1 月 24 日
I also encountered the misplacement of the imported onnx model. I exported the pre-trained alexnet in pytorch, but the following error occurred when importing onnx in matlab. How can I solve this problem? Thank you
360截图20190124154320093.jpg
  3 件のコメント
cui,xingxing
cui,xingxing 2019 年 1 月 26 日
It' same error, thank your advice! but i want to use other model networks in pytorch,then import to matlab to use.
importONNXNetwork/importONNXLayers does not seem to be perfect, there are many operations that are not supported, and it is hoped that the 2019a version will provide its robustness.
Kevin Chng
Kevin Chng 2019 年 1 月 27 日
Ya, i guess not all the layers of deep learning are supported by MATLAB currently.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeImage Data Workflows についてさらに検索

製品


リリース

R2018a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by