This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

Deep Learning Import, Export, and Customization

Import and export networks and define custom deep learning layers and datastores

Import networks and network architectures from TensorFlow®-Keras, 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.

You can define your own custom deep learning layer for your problem. You can define custom output layers and custom layers with or without learnable parameters. For example, you can use a custom weighted classification layer with weighted cross entropy loss for classification problems with an imbalanced distribution of classes. You can check layers for validity, GPU compatibility, and correctly defined gradients.

For full flexibility in preprocessing image and sequence data, build your own datastore for training deep learning networks. You can optionally add support for functionality such as shuffling during training, parallel and multi-GPU training, and background dispatch.

Functions

expand all

importKerasNetworkImport a pretrained Keras network and weights
importKerasLayersImport layers from Keras network
importCaffeNetworkImport pretrained convolutional neural network models from Caffe
importCaffeLayersImport convolutional neural network layers from Caffe
importONNXNetworkImport pretrained ONNX network
importONNXLayersImport layers from ONNX network
exportONNXNetworkExport network to ONNX model format
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
setLearnRateFactorSet learn rate factor of layer learnable parameter
setL2FactorSet L2 regularization factor of layer learnable parameter
getLearnRateFactorGet learn rate factor of layer learnable parameter
getL2FactorGet L2 regularization factor of layer learnable parameter
checkLayerCheck validity of custom layer

Classes

expand all

MiniBatchableAdd mini-batch support to datastore
BackgroundDispatchableAdd prefetch reading support to datastore
PartitionableByIndexAdd parallelization support to datastore
ShuffleableAdd shuffling support to datastore

Topics

Define Custom Deep Learning Layers

Learn how to define custom deep learning layers

Define a Custom Deep Learning Layer with Learnable Parameters

This example shows how to define a PReLU layer and use it in a convolutional neural network.

Define Custom Weighted Classification Layer

This example shows how to define and create a custom weighted classification output layer with weighted cross entropy loss.

Define a Custom Regression Output Layer

This example shows how to define a custom regression output layer with mean absolute error (MAE) loss and use it in a convolutional neural network.

Define a Custom Classification Output Layer

This example shows how to define a custom classification output layer with sum of squares error (SSE) loss and use it in a convolutional neural network.

Check Custom Layer Validity

Learn how to check the validity of custom deep learning layers

Develop Custom Mini-Batch Datastore

Create a fully customized mini-batch datastore that contains training and test data sets for network training, prediction, and classification.

Train Network Using Out-of-Memory Sequence Data

This example shows how to train a deep learning network on out-of-memory sequence data using a custom mini-batch datastore.

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.

Deep Learning Tips and Tricks

Learn how to improve the accuracy of deep learning networks.

Featured Examples