Main Content

Deep Learning Import and Export

Import networks from and export networks to external deep learning platforms

Import networks and network architectures from TensorFlow™-Keras, TensorFlow 2, Caffe, and the ONNX™ (Open Neural Network Exchange) model format. You can also export a trained Deep Learning Toolbox™ network to the ONNX model format.

Functions

expand all

TensorFlow-Keras Import

importKerasNetworkImport pretrained Keras network and weights
importKerasLayersImport layers from Keras network
importTensorFlowNetworkImport pretrained TensorFlow network
importTensorFlowLayersImport layers from TensorFlow 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
findPlaceholderLayersFind placeholder layers in network architecture imported from Keras or ONNX
replaceLayerReplace layer in layer graph
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
removeLayersRemove layers from layer graph
exportONNXNetworkExport network to ONNX model format

Topics

Assemble Network from Pretrained Keras Layers

This example shows how to import the layers from a pretrained Keras network, replace the unsupported layers with custom layers, and assemble the layers into a network ready for prediction.

Deploy Imported Network with MATLAB Compiler

Import Keras and ONNX pretrained networks and deploy the networks using MATLAB® Compiler™.

Select Function to Import ONNX Pretrained Network

Import an ONNX pretrained network using importONNXNetwork, importONNXLayers, or importONNXFunction.