Only image inputs are supported for import using 'importONNXNetwork'

Hello,
My question in regarding the add-on 'importONNXNetwork'.
I am unable to load a ONNX model in MATLAB (2018b). The model is trained in PyTorch.
Input to the model is a vector and not an image.
I get following error: 'Only image inputs are supported for import'.
I am wondering if this is because MATLAB add-on doesn't (yet) support loading of ONNX models with non-image inputs.
Please let me know. Thanks in advance.
Regards,
Pramod

回答 (3 件)

matteo baigura
matteo baigura 2020 年 2 月 1 日
編集済み: matteo baigura 2020 年 2 月 1 日

2 投票

Same problem, if you are right that's simply ridicolous
Josiah Wai
Josiah Wai 2022 年 1 月 17 日
編集済み: Josiah Wai 2022 年 1 月 17 日

0 投票

I also had this problem and was able to get around it by reshaping the onnx input vector.
  1. To export from pytorch to onnx, follow the steps at https://pytorch.org/tutorials/advanced/super_resolution_with_onnxruntime.html However, before running the torch.onnx.export command, set the shape of your input vector x. In my case, each input sample vector has size 33, so I did: x = torch.randn(1,1,33, requires_grad=True)
  2. Import to Matlab
net = importONNXNetwork(modelfile, 'OutputLayerType', 'regression')
x = rand(33,1)
y = predict(net, x)
yanqi liu
yanqi liu 2022 年 1 月 17 日

0 投票

yes,sir,may be transfer data to cell and save as mat file,then use reshape to modify data dimension

カテゴリ

ヘルプ センター および File ExchangeDeep Learning Toolbox についてさらに検索

製品

質問済み:

2019 年 8 月 23 日

回答済み:

2022 年 1 月 17 日

Community Treasure Hunt

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

Start Hunting!

Translated by