MATLAB® Coder™ supports code generation for series, directed acyclic graph (DAG), and recurrent convolutional neural networks (CNNs or ConvNets). You can generate code for any trained convolutional neural network whose layers are supported for code generation. See Supported Layers.
The following pretrained networks, available in Deep Learning Toolbox™, are supported for code generation.
Network Name | Description | ARM® Compute Library | Intel® MKL-DNN |
---|---|---|---|
AlexNet | AlexNet convolutional neural network. For the pretrained AlexNet model,
see | Yes | Yes |
DarkNet | DarkNet-19 and DarkNet-53 convolutional neural networks. For the pretrained
DarkNet models, see darknet19 (Deep Learning Toolbox)
and darknet53 (Deep Learning Toolbox). | Yes | Yes |
DenseNet-201 | DenseNet-201 convolutional neural network. For the pretrained
DenseNet-201 model, see | Yes | Yes |
EfficientNet-b0 | EfficientNet-b0 convolutional neural network. For the pretrained
EfficientNet-b0 model, see | Yes | Yes |
GoogLeNet | GoogLeNet convolutional neural network. For the pretrained GoogLeNet
model, see | Yes | Yes |
Inception-ResNet-v2 | Inception-ResNet-v2 convolutional neural network. For the pretrained
Inception-ResNet-v2 model, see | Yes | Yes |
Inception-v3 | Inception-v3 convolutional neural network. For the pretrained Inception-v3
model, see inceptionv3 (Deep Learning Toolbox). | Yes | Yes |
MobileNet-v2 | MobileNet-v2 convolutional neural network. For the pretrained
MobileNet-v2 model, see | Yes | Yes |
NASNet-Large | NASNet-Large convolutional neural network. For the pretrained
NASNet-Large model, see | Yes | Yes |
NASNet-Mobile | NASNet-Mobile convolutional neural network. For the pretrained
NASNet-Mobile model, see | Yes | Yes |
ResNet | ResNet-18, ResNet-50, and ResNet-101 convolutional neural networks. For
the pretrained ResNet models, see | Yes | Yes |
SegNet | Multi-class pixelwise segmentation network. For more information, see
| No | Yes |
SqueezeNet | Small, deep neural network. For the pretrained SqeezeNet models, see
| Yes | Yes |
VGG-16 | VGG-16 convolutional neural network. For the pretrained VGG-16 model, see
| Yes | Yes |
VGG-19 | VGG-19 convolutional neural network. For the pretrained VGG-19 model, see
| Yes | Yes |
Xception | Xception convolutional neural network. For the pretrained Xception model,
see | Yes | Yes |
The following layers are supported for code generation by MATLAB Coder for the target deep learning libraries specified in the table.
Once you install the support package MATLAB Coder Interface for Deep Learning Libraries, you can use coder.getDeepLearningLayers
to see a list of the layers supported for a
specific deep learning library. For example:
coder.getDeepLearningLayers('mkldnn')
Layer Name | Description | ARM Compute Library | Intel MKL-DNN |
---|---|---|---|
additionLayer (Deep Learning Toolbox) | Addition layer | Yes | Yes |
anchorBoxLayer (Computer Vision Toolbox) | Anchor box layer | Yes | Yes |
averagePooling2dLayer (Deep Learning Toolbox) | Average pooling layer | Yes | Yes |
batchNormalizationLayer (Deep Learning Toolbox) | Batch normalization layer | Yes | Yes |
bilstmLayer (Deep Learning Toolbox) | Bidirectional LSTM layer | Yes | Yes |
classificationLayer (Deep Learning Toolbox) | Create classification output layer | Yes | Yes |
clippedReluLayer (Deep Learning Toolbox) | Clipped Rectified Linear Unit (ReLU) layer | Yes | Yes |
concatenationLayer (Deep Learning Toolbox) | Concatenation layer | Yes | Yes |
convolution2dLayer (Deep Learning Toolbox) | 2-D convolution layer | Yes | Yes |
crop2dLayer (Deep Learning Toolbox) | Layer that applies 2-D cropping to the input | Yes | Yes |
CrossChannelNormalizationLayer (Deep Learning Toolbox) | Channel-wise local response normalization layer | Yes | Yes |
Custom layers | Custom layers, with or without learnable parameters, that you define for your problem. See:
The outputs of the custom layer must be fixed-size arrays. Custom layers in sequence networks are not supported for code generation. | Yes
| Yes |
Custom output layers | All output layers including
custom classification or regression output layers created by using
For an example showing how to define a custom classification output layer and specify a loss function, see Define Custom Classification Output Layer (Deep Learning Toolbox). For an example showing how to define a custom regression output layer and specify a loss function, see Define Custom Regression Output Layer (Deep Learning Toolbox). | Yes | Yes |
depthConcatenationLayer (Deep Learning Toolbox) | Depth concatenation layer | Yes | Yes |
dicePixelClassificationLayer (Computer Vision Toolbox) | A Dice pixel classification layer provides a categorical label for each image pixel or voxel using generalized Dice loss. | Yes | Yes |
dropoutLayer (Deep Learning Toolbox) | Dropout layer | Yes | Yes |
eluLayer (Deep Learning Toolbox) | Exponential linear unit (ELU) layer | Yes | Yes |
focalLossLayer (Computer Vision Toolbox) | A focal loss layer predicts object classes using focal loss. | Yes | Yes |
fullyConnectedLayer (Deep Learning Toolbox) | Fully connected layer | Yes | Yes |
globalAveragePooling2dLayer (Deep Learning Toolbox) | Global average pooling layer for spatial data | Yes | Yes |
globalMaxPooling2dLayer (Deep Learning Toolbox) | 2-D global max pooling layer | Yes | Yes |
| 2-D grouped convolutional layer | Yes
| Yes |
| Gated recurrent unit (GRU) layer | Yes | Yes |
imageInputLayer (Deep Learning Toolbox) | Image input layer
| Yes | Yes |
leakyReluLayer (Deep Learning Toolbox) | Leaky Rectified Linear Unit (ReLU) layer | Yes | Yes |
lstmLayer (Deep Learning Toolbox) | Long short-term memory (LSTM) layer | Yes | Yes |
maxPooling2dLayer (Deep Learning Toolbox) | Max pooling layer | Yes | Yes |
maxUnpooling2dLayer (Deep Learning Toolbox) | Max unpooling layer | No | Yes |
multiplicationLayer (Deep Learning Toolbox) | Multiplication layer | Yes | Yes |
pixelClassificationLayer (Computer Vision Toolbox) | Create pixel classification layer for semantic segmentation | Yes | Yes |
rcnnBoxRegressionLayer (Computer Vision Toolbox) | Box regression layer for Fast and Faster R-CNN | Yes | Yes |
rpnClassificationLayer (Computer Vision Toolbox) | Classification layer for region proposal networks (RPNs) | Yes | Yes |
regressionLayer (Deep Learning Toolbox) | Create a regression output layer | Yes | Yes |
reluLayer (Deep Learning Toolbox) | Rectified Linear Unit (ReLU) layer | Yes | Yes |
scalingLayer (Reinforcement Learning Toolbox) | Scaling layer for actor or critic network | Yes | Yes |
sigmoidLayer (Deep Learning Toolbox) | Sigmoid layer | Yes | Yes |
sequenceInputLayer (Deep Learning Toolbox) | Sequence input layer
| Yes | Yes |
softmaxLayer (Deep Learning Toolbox) | Softmax layer | Yes | Yes |
softplusLayer (Reinforcement Learning Toolbox) | Softplus layer for actor or critic network | Yes | Yes |
spaceToDepthLayer (Computer Vision Toolbox) | Space to depth layer | Yes | Yes |
ssdMergeLayer (Computer Vision Toolbox) | SSD merge layer for object detection | Yes | Yes |
| Flattens activations into 1-D assuming C-style (row-major) order | Yes | Yes |
nnet.keras.layer.GlobalAveragePooling2dLayer | Global average pooling layer for spatial data | Yes | Yes |
| Sigmoid activation layer | Yes | Yes |
| Hyperbolic tangent activation layer | Yes | Yes |
| Zero padding layer for 2-D input | Yes | Yes |
nnet.onnx.layer.ElementwiseAffineLayer | Layer that performs element-wise scaling of the input followed by an addition | Yes | Yes |
| Flatten layer for ONNX™ network | Yes | Yes |
| Layer that implements ONNX identity operator | Yes | Yes |
| Hyperbolic tangent (tanh) layer | Yes | Yes |
| Transposed 2-D convolution layer Code generation does not
support asymmetric cropping of the input. For example, specifying a vector
| Yes | Yes |
| A word embedding layer maps word indices to vectors | Yes | Yes |
| Output layer for YOLO v2 object detection network | Yes | Yes |
| Reorganization layer for YOLO v2 object detection network | Yes | Yes |
| Transform layer for YOLO v2 object detection network | Yes | Yes |
Class | Description | ARM Compute Library | Intel MKL-DNN |
---|---|---|---|
|
| Yes | Yes |
ssdObjectDetector (Computer Vision Toolbox) | Object to detect objects using the SSD-based detector.
| Yes | Yes |