Main Content

Pretrained Networks from External Platforms

Import pretrained networks from 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. 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 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.

Diagram showing the interoperability between Deep Learning Toolbox, TensorFlow, ONNX, and PyTorch.


alle erweitern

TensorFlow Import

importNetworkFromTensorFlowImport TensorFlow network as MATLAB network (Seit R2023b)
importTensorFlowNetwork(To be removed) Import pretrained TensorFlow network (Seit R2021a)
importTensorFlowLayers(To be removed) Import layers from TensorFlow network (Seit R2021a)
importKerasNetwork(To be removed) Import pretrained Keras network and weights
importKerasLayers(To be removed) Import layers from Keras network

PyTorch Import

importNetworkFromPyTorchImport PyTorch network as MATLAB network (Seit R2022b)

Caffe Import

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

ONNX Import

importNetworkFromONNXImport ONNX network as MATLAB network (Seit R2023b)
importONNXNetwork(To be removed) Import pretrained ONNX network
importONNXLayers(To be removed) Import layers from ONNX network
importONNXFunctionImport pretrained ONNX network as a function (Seit R2020b)

Parameters Imported by importONNXFunction

ONNXParametersParameters of imported ONNX network for deep learning (Seit R2020b)
freezeParametersConvert learnable network parameters in ONNXParameters to nonlearnable (Seit R2020b)
unfreezeParametersConvert nonlearnable network parameters in ONNXParameters to learnable (Seit R2020b)
addParameterAdd parameter to ONNXParameters object (Seit R2020b)
removeParameterRemove parameter from ONNXParameters object (Seit R2020b)
functionLayerFunction layer (Seit R2021b)
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
addLayersAdd layers to layer graph or network
removeLayersRemove layers from layer graph or network



Custom Layers