MATLAB Answers

error Loading onnx model exported from pytorch to matlab

15 ビュー (過去 30 日間)
Yasser Belal
Yasser Belal 2020 年 1 月 20 日
回答済み: Shashank Gupta 2020 年 1 月 23 日
Hi!
I trained a neural network regression (numerical input/output data) model in Pytorch and I want to load it to MATLAB.
I followed the instructions to do so, firstly by converting the pretrained network from Pytorch to .onnx format.
However when I try to load it to MATLAB environment using the MATLAB Deep Learning Toolbox Converter for ONNX Model Format
network = importONNXNetwork('model.onnx', 'OutputLayerType', 'regression')
, I get the following error:
Only image inputs are supported for import
Does this toolbox converter for onnx, just support models with image inputs?

  0 件のコメント

サインイン to comment.

回答 (1 件)

Shashank Gupta
Shashank Gupta 2020 年 1 月 23 日
Hi Yasser,
Yeah right now “importONNXNetwork” only support 3D-sequence-batch tensor or 4D image batch tensor. you can perhaps recode the 2D input as a 4D image batch tensor. In pytorch, an image batch tensor has the layout [batch, channel, height, width]. If the [h,w] input tensor could be recoded as a [h,w,1,1] tensor in pytorch, then that might be importable into a MATLAB “imageInputLayer”. (Or, you may need to omit the batch dimension in pytorch and declare it to be [h,w,1] )
I hope this helps.

  0 件のコメント

サインイン to comment.

サインイン してこの質問に回答します。


Translated by