How to solve the error when trying to convert a DAGNetwork to ONNX?

7 views (last 30 days)
I use Matlab R2021b and toolbox Converter for ONNX model version 21.2.
I only used these code:
net=load('pointnetplusTrained.mat','net').net;
filename = "pointnetplusTrained.onnx";
exportONNXNetwork(net,filename)
My net here has a value of 1X1 DAGNetwork and looks like this
The model is trained the same as Matlab documentation:
Error message shows below
Error using containers.Map/subsref
The specified key is not present in this container.
Error in nnet.internal.cnn.onnx.ConverterForConvolutionLayers/toOnnx (line 19)
inputTensorLayout = TensorLayoutMap(inputTensorNames{1});
Error in nnet.internal.cnn.onnx.ConverterForNetwork/networkToGraphProto (line 115)
= toOnnx(layerConverter, nodeProtos, TensorNameMap, TensorLayoutMap);
Error in nnet.internal.cnn.onnx.ConverterForNetwork/toOnnx (line 45)
modelProto.graph = networkToGraphProto(this);
Error in nnet.internal.cnn.onnx.exportONNXNetwork (line 17)
modelProto = toOnnx(converter);
Error in exportONNXNetwork (line 38)
nnet.internal.cnn.onnx.exportONNXNetwork(Network, filename, varargin{:});
Error in untitled3 (line 3)
exportONNXNetwork(net,filename)
Thanks in advance.

Accepted Answer

Don Mathis
Don Mathis on 29 Mar 2022
Hi,
Unfortunately, this is a bug in the ONNX exporter. If you are able to edit your MATLAB source code, you can fix it as follows:
In MATLAB, enter
edit nnet.internal.cnn.onnx.ConverterForUnsupportedLayer
Then change line 42 from
if isequal(OutputNames, {'out'})
to
if numel(OutputNames)==1

More Answers (0)

Products


Release

R2021b

Community Treasure Hunt

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

Start Hunting!