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 specify a custom loss function using a custom output layers and define 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. After defining a custom layer, you can check that the layer is valid, GPU compatible, and outputs correctly defined gradients.
If the trainingOptions
function does
not provide the training options that you need for your task, or custom
output layers do not support the loss functions that you need, then you can
define a custom training loop. For networks that cannot be created using
layer graphs, you can define custom networks as a function. To learn more,
see Define Custom Training Loops, Loss Functions, and Networks.
Define Custom Deep Learning Layers
Learn how to define custom deep learning layers.
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.
Specify Custom Layer Backward Function
This example shows how to define a PReLU layer and specify a custom backward function.
Specify Custom Output Layer Backward Loss Function
This example shows how to define a weighted classification layer and specify a custom backward loss function.
Train Generative Adversarial Network (GAN)
This example shows how to train a generative adversarial network (GAN) to generate images.
Train Conditional Generative Adversarial Network (CGAN)
This example shows how to train a conditional generative adversarial network (CGAN) to generate images.
Train a Siamese Network for Dimensionality Reduction
This example shows how to train a Siamese network to compare handwritten digits using dimensionality reduction.
Train a Siamese Network to Compare Images
This example shows how to train a Siamese network to identify similar images of handwritten characters.
Define Custom Training Loops, Loss Functions, and Networks
Learn how to define and customize deep learning training loops, loss functions, and networks using automatic differentiation.
Specify Training Options in Custom Training Loop
Learn how to specify common training options in a custom training loop.
Train Network Using Custom Training Loop
This example shows how to train a network that classifies handwritten digits with a custom learning rate schedule.
Update Batch Normalization Statistics in Custom Training Loop
This example shows how to update the network state in a custom training loop.
Make Predictions Using dlnetwork Object
This example shows how to make predictions using a dlnetwork
object by splitting data into mini-batches.
Train Network Using Model Function
This example shows how to create and train a deep learning network by using functions rather than a layer graph or a dlnetwork
.
Update Batch Normalization Statistics Using Model Function
This example shows how to update the network state in a network defined as a function.
Make Predictions Using Model Function
This example shows how to make predictions using a model function by splitting data into mini-batches.
Compare Layer Weight Initializers
This example shows how to train deep learning networks with different weight initializers.
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.
Multiple-Input and Multiple-Output Networks
Learn how to define and train deep learning networks with multiple inputs or multiple outputs.
Train Network with Multiple Outputs
This example shows how to train a deep learning network with multiple outputs that predict both labels and angles of rotations of handwritten digits.
Assemble Multiple-Output Network for Prediction
Instead of using the model function for prediction, you can assemble the network into a DAGNetwork
ready for prediction using the functionToLayerGraph
and assembleNetwork
functions.
Automatic Differentiation Background
Learn how automatic differentiation works.
Use Automatic Differentiation In Deep Learning Toolbox
How to use automatic differentiation in deep learning.
List of Functions with dlarray Support
View the list of functions that support dlarray
objects.
Grad-CAM Reveals the Why Behind Deep Learning Decisions
This example shows how to use the gradient-weighted class activation mapping (Grad-CAM) technique to understand why a deep learning network makes its classification decisions.