Main Content

Deep Learning Import and Export

Import networks from and export networks to external deep learning platforms

Import networks and layer graphs from TensorFlow™ 2, TensorFlow-Keras, PyTorch®, the ONNX™ (Open Neural Network Exchange) model format, and Caffe. You can also export Deep Learning Toolbox™ networks and layer graphs to TensorFlow 2 and the ONNX model format. For more information, see Pretrained Deep Neural Networks and Interoperability Between Deep Learning Toolbox, TensorFlow, PyTorch, and ONNX.

You must have support packages to run the import and export functions in Deep Learning Toolbox. If the support package is not installed, each function provides a download link to the corresponding support package in the Add-On Explorer. A recommended practice is to download the support package to the default location for the version of MATLAB® you are running. You can also directly download the support packages from the following links.

Functions

expand all

TensorFlow Import

importTensorFlowNetworkImport pretrained TensorFlow network
importTensorFlowLayersImport layers from TensorFlow network
importKerasNetworkImport pretrained Keras network and weights
importKerasLayersImport layers from Keras network

PyTorch Import

importNetworkFromPyTorchImport PyTorch model as MATLAB network

Caffe Import

importCaffeNetworkImport pretrained convolutional neural network models from Caffe
importCaffeLayersImport convolutional neural network layers from Caffe

ONNX Import

importONNXNetworkImport pretrained ONNX network
importONNXLayersImport layers from ONNX network
importONNXFunctionImport pretrained ONNX network as a function

Parameters Imported by importONNXFunction

ONNXParametersParameters of imported ONNX network for deep learning
freezeParametersConvert learnable network parameters in ONNXParameters to nonlearnable
unfreezeParametersConvert nonlearnable network parameters in ONNXParameters to learnable
addParameterAdd parameter to ONNXParameters object
removeParameterRemove parameter from ONNXParameters object
functionLayerFunction layer
findPlaceholderLayersFind placeholder layers in network architecture imported from Keras or ONNX
replaceLayerReplace layer in layer graph or network
assembleNetworkAssemble deep learning network from pretrained layers
PlaceholderLayerLayer replacing an unsupported Keras or ONNX layer, or unsupported functionality from functionToLayerGraph
addLayersAdd layers to layer graph or network
removeLayersRemove layers from layer graph or network
exportNetworkToTensorFlowExport Deep Learning Toolbox network or layer graph to TensorFlow
exportONNXNetworkExport network to ONNX model format

Topics