Export network to ONNX model format
exportONNXNetwork(
exports the deep learning network net
,filename
)net
with weights to the ONNX™ format file filename
. If
filename
exists, then exportONNXNetwork
overwrites the
file.
This function requires the Deep Learning Toolbox™ Converter for ONNX Model Format support package. If this support package is not installed, then the function provides a download link.
exportONNXNetwork(
exports a network using additional options specified by one or more name-value pair
arguments.net
,filename
,Name,Value
)
You can export a trained MATLAB® deep learning network that includes multiple inputs and multiple outputs to the ONNX model format. To learn about a multiple-input and multiple-output deep learning network, see Multiple-Input and Multiple-Output Networks.
exportONNXNetwork
does not export settings or properties related to
network training such as training options, learning rate factors, or regularization
factors.
If you export a network that contains a layer that the ONNX format does not support, then exportONNXNetwork
saves a
placeholder ONNX operator in place of the unsupported
layer and returns a warning. You cannot import an ONNX network with a placeholder operator into other deep learning
frameworks.
Because of architectural differences between MATLAB and ONNX, an exported network can have a different structure compared to the original network. Also, if you import an exported network, layers of a reimported network might differ from the original network.
exportONNXNetwork
can export the following:
Networks that have both convolutional and LSTM layers, for example, for video classification applications.
All custom layers (except nnet.onnx.layer.Flatten3dLayer
)
that are created when importing networks from ONNX or TensorFlow™-Keras using Deep Learning Toolbox Converter for ONNX Model Format or Deep Learning Toolbox Importer for TensorFlow-Keras Models as in the below table.
The following layers:
importCaffeLayers
| importCaffeNetwork
| importKerasLayers
| importKerasNetwork
| importONNXLayers
| importONNXNetwork