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, define custom deep learning layers, and customize 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 out-of-memory data, you can create and customize datastores to preprocess your data for training deep learning networks.

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
matlab.io.datastore.MiniBatchableAdd mini-batch support to datastore

Topics

Custom Layers

Define Custom Deep Learning Layers

Learn how to define custom deep learning layers

Check Custom Layer Validity

Learn how to check the validity of custom deep learning layers

Define 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 Deep Learning Layer with Multiple Inputs

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

Define 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.

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 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.

Datastore Customization

Datastores for Deep Learning

Learn how to use datastores in deep learning applications.

Prepare Datastore for Image-to-Image Regression

This example shows how to prepare a datastore for training an image-to-image regression network using the transform and combine functions of ImageDatastore.

Train Network Using Out-of-Memory Sequence Data

This example shows how to train a deep learning network on out-of-memory sequence data by transforming and combining datastores.

Classify Text Data Using Convolutional Neural Network

This example shows how to classify text data using a convolutional neural network.

Classify Out-of-Memory Text Data Using Deep Learning

This example shows how to classify out-of-memory text data with a deep learning network using a transformed datastore.

Network Training and Assembly

Deep Learning Tips and Tricks

Learn how to improve the accuracy of deep learning networks.

Specify Custom Weight Initialization Function

This example shows how to create a custom He weight initialization function for convolution layers followed by leaky ReLU layers.

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.

Customize Output During Deep Learning Network Training

This example shows how to define an output function that runs at each iteration during training of deep learning neural networks.

Featured Examples