Converting from onnx generated by matlab is not working with other frameworks
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
umit kacar
am 19 Sep. 2018
Beantwortet: michael scheinfeild
am 16 Apr. 2019
I am trying to use my pretrained model in c++ application. I tried to convert from onnx to mxnet, pytorch and directly to caffe. All of them fails. Downloaded pretrained models work without any problems while importing into mxnet. https://mxnet.incubator.apache.org/tutorials/onnx/super_resolution.html This is the guide i followed. And .onnx file is added. Also error message is added with image.png. I am waiting your reply as soon as possible. Thank you in advance.
0 Kommentare
Akzeptierte Antwort
Don Mathis
am 21 Sep. 2018
Hi Umit, That is a bug in whatever ONNX importer you are trying to use. It is failing because the ONNX file contains a 'Sub' operator that does not specify the 'axis' attribute. According to the ONNX specification, 'axis' is an optional attribute that has a default value. Yet the importer you are using incorrectly requires it.
According to the ONNX spec (https://github.com/onnx/onnx/blob/master/docs/Changelog.md#Sub-6):
"The starting of the mutually equal shape is specified by the argument "axis", and if it is not set, suffix matching is assumed."
The ONNX file you have attached can be imported into Tensorflow, and in that case the predictions made by the model match those of the original MATLAB network.
I suggest you file a bug report with whoever wrote the ONNX importer you are using.
1 Kommentar
Don Mathis
am 28 Sep. 2018
I also recommend making sure you always have the latest monthly update of the ONNX converter.
Weitere Antworten (1)
michael scheinfeild
am 16 Apr. 2019
after exported to onnx you can use cntk framework in python and then in c++
python code:
import cntk as C
import os
import numpy as np
from PIL import Image,ImageOps
#check cntk
print("imported cntk")
print(C.minus([1, 2, 3], [4, 5, 6]).eval())
#check onnx exist
print(np.DataSource().exists("net.onnx"))
#load onnx
z = C.Function.load("net.onnx", format=C.ModelFormat.ONNX)
# then you can save it to dnn format
z.save(os.path.join("foo", "Alexnet" + ".dnn"))
0 Kommentare
Siehe auch
Kategorien
Mehr zu Deep Learning Toolbox finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!