Main Content

Supported Networks, Layers, and Classes

Supported Pretrained Networks

GPU Coder™ supports code generation for series and directed acyclic graph (DAG) convolutional neural networks (CNNs or ConvNets). You can generate code for a trained convolutional neural network whose layers are supported for code generation. See Supported Layers. You can train a convolutional neural network on either a CPU, a GPU, or multiple GPUs by using the Deep Learning Toolbox™ or use one of the pretrained networks listed in the table and generate CUDA® code.

Network NameDescriptioncuDNNTensorRTARM® Compute Library for Mali GPU

AlexNet

AlexNet convolutional neural network. For the pretrained AlexNet model, see alexnet (Deep Learning Toolbox).

The syntax alexnet('Weights','none') is not supported for code generation.

Yes

Yes

Yes

Caffe Network

Convolutional neural network models from Caffe. For importing a pretrained network from Caffe, see importCaffeNetwork (Deep Learning Toolbox).

Yes

Yes

Yes

Darknet-19

Darknet-19 convolutional neural network. For more information, see darknet19 (Deep Learning Toolbox).

The syntax darknet19('Weights','none') is not supported for code generation.

Yes

Yes

Yes

Darknet-53

Darknet-53 convolutional neural network. for more information, see darknet53 (Deep Learning Toolbox).

The syntax darknet53('Weights','none') is not supported for code generation.

Yes

Yes

Yes

DeepLab v3+

DeepLab v3+ convolutional neural network. For more information, see deeplabv3plusLayers (Computer Vision Toolbox).

Yes

Yes

No

DenseNet-201

DenseNet-201 convolutional neural network. For the pretrained DenseNet-201 model, see densenet201 (Deep Learning Toolbox).

The syntax densenet201('Weights','none') is not supported for code generation.

Yes

Yes

Yes

EfficientNet-b0

EfficientNet-b0 convolutional neural network. For the pretrained EfficientNet-b0 model, see efficientnetb0 (Deep Learning Toolbox).

The syntax efficientnetb0('Weights','none') is not supported for code generation.

YesYesYes

GoogLeNet

GoogLeNet convolutional neural network. For the pretrained GoogLeNet model, see googlenet (Deep Learning Toolbox).

The syntax googlenet('Weights','none') is not supported for code generation.

Yes

Yes

Yes

Inception-ResNet-v2

Inception-ResNet-v2 convolutional neural network. For the pretrained Inception-ResNet-v2 model, see inceptionresnetv2 (Deep Learning Toolbox).

Yes

Yes

No

Inception-v3

Inception-v3 convolutional neural network. For the pretrained Inception-v3 model, see inceptionv3 (Deep Learning Toolbox).

The syntax inceptionv3('Weights','none') is not supported for code generation.

Yes

Yes

Yes

Mobilenet-v2

MobileNet-v2 convolutional neural network. For the pretrained MobileNet-v2 model, see mobilenetv2 (Deep Learning Toolbox).

The syntax mobilenetv2('Weights','none') is not supported for code generation.

Yes

Yes

Yes

NASNet-Large

NASNet-Large convolutional neural network. For the pretrained NASNet-Large model, see nasnetlarge (Deep Learning Toolbox).

Yes

Yes

No

NASNet-Mobile

NASNet-Mobile convolutional neural network. For the pretrained NASNet-Mobile model, see nasnetmobile (Deep Learning Toolbox).

Yes

Yes

No

ResNet

ResNet-18, ResNet-50, and ResNet-101 convolutional neural networks. For the pretrained ResNet models, see resnet50 (Deep Learning Toolbox), resnet18 (Deep Learning Toolbox), and resnet101 (Deep Learning Toolbox).

The syntax resnetXX('Weights','none') is not supported for code generation.

Yes

Yes

Yes

SegNet

Multi-class pixelwise segmentation network. For more information, see segnetLayers (Computer Vision Toolbox).

Yes

Yes

No

SqueezeNet

Small deep neural network. For the pretrained SqueezeNet models, see squeezenet (Deep Learning Toolbox).

The syntax squeezenet('Weights','none') is not supported for code generation.

Yes

Yes

Yes

VGG-16

VGG-16 convolutional neural network. For the pretrained VGG-16 model, see vgg16 (Deep Learning Toolbox).

The syntax vgg16('Weights','none') is not supported for code generation.

Yes

Yes

Yes

VGG-19

VGG-19 convolutional neural network. For the pretrained VGG-19 model, see vgg19 (Deep Learning Toolbox).

The syntax vgg19('Weights','none') is not supported for code generation.

Yes

Yes

Yes

Xception

Xception convolutional neural network. For the pretrained Xception model, see xception (Deep Learning Toolbox).

The syntax xception('Weights','none') is not supported for code generation.

Yes

Yes

Yes

YOLO v2

You only look once version 2 convolutional neural network based object detector. For more information, see yolov2Layers (Computer Vision Toolbox)

Yes

Yes

Yes

Supported Layers

The following layers are supported for code generation by GPU Coder for the target deep learning libraries specified in the table.

Input Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

imageInputLayer (Deep Learning Toolbox)

An image input layer inputs 2-D images to a network and applies data normalization.

Code generation does not support 'Normalization' specified using a function handle.

Yes

Yes

Yes

sequenceInputLayer (Deep Learning Toolbox)

A sequence input layer inputs sequence data to a network.

The cuDNN library supports vector and 2-D image sequences. The TensorRT library support only vector input sequences.

For vector sequence inputs, the number of features must be a constant during code generation.

For image sequence inputs, the height, width, and the number of channels must be a constant during code generation.

Code generation does not support 'Normalization' specified using a function handle.

Yes

Yes

No

featureInputLayer (Deep Learning Toolbox)

A feature input layer inputs feature data to a network and applies data normalization.

Yes

Yes

Yes

Convolution and Fully Connected Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

convolution2dLayer (Deep Learning Toolbox)

A 2-D convolutional layer applies sliding convolutional filters to the input.

Yes

Yes

Yes

fullyConnectedLayer (Deep Learning Toolbox)

A fully connected layer multiplies the input by a weight matrix and then adds a bias vector.

Yes

Yes

No

groupedConvolution2dLayer (Deep Learning Toolbox)

A 2-D grouped convolutional layer separates the input channels into groups and applies sliding convolutional filters. Use grouped convolutional layers for channel-wise separable (also known as depth-wise separable) convolution.

Code generation for the ARM Mali GPU is not supported for a 2-D grouped convolution layer that has the NumGroups property set as 'channel-wise' or a value greater than two.

Yes

Yes

Yes

transposedConv2dLayer (Deep Learning Toolbox)

A transposed 2-D convolution layer upsamples feature maps.

Yes

Yes

Yes

Sequence Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

sequenceInputLayer (Deep Learning Toolbox)

A sequence input layer inputs sequence data to a network.

The cuDNN library supports vector and 2-D image sequences. The TensorRT library support only vector input sequences.

For vector sequence inputs, the number of features must be a constant during code generation.

For image sequence inputs, the height, width, and the number of channels must be a constant during code generation.

Code generation does not support 'Normalization' specified using a function handle.

Yes

Yes

No

bilstmLayer (Deep Learning Toolbox)

A bidirectional LSTM (BiLSTM) layer learns bidirectional long-term dependencies between time steps of time series or sequence data. These dependencies can be useful when you want the network to learn from the complete time series at each time step.

For code generation, the StateActivationFunction property must be set to 'tanh'.

For code generation, the GateActivationFunction property must be set to 'sigmoid'.

Yes

Yes

No

flattenLayer (Deep Learning Toolbox)

A flatten layer collapses the spatial dimensions of the input into the channel dimension.

Yes

No

No

gruLayer (Deep Learning Toolbox)

A GRU layer learns dependencies between time steps in time series and sequence data.

Code generation supports only the 'after-multiplication' and 'recurrent-bias-after-multiplication' reset gate modes.

Yes

Yes

No

lstmLayer (Deep Learning Toolbox)

An LSTM layer learns long-term dependencies between time steps in time series and sequence data.

For code generation, the StateActivationFunction property must be set to 'tanh'.

For code generation, the GateActivationFunction property must be set to 'sigmoid'.

Yes

Yes

No

sequenceFoldingLayer (Deep Learning Toolbox)

A sequence folding layer converts a batch of image sequences to a batch of images. Use a sequence folding layer to perform convolution operations on time steps of image sequences independently.

Yes

No

No

sequenceUnfoldingLayer (Deep Learning Toolbox)

A sequence unfolding layer restores the sequence structure of the input data after sequence folding.

Yes

No

No

wordEmbeddingLayer (Text Analytics Toolbox)

A word embedding layer maps word indices to vectors.

Yes

Yes

No

Activation Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

clippedReluLayer (Deep Learning Toolbox)

A clipped ReLU layer performs a threshold operation, where a input value less than zero is set to zero and a value above the clipping ceiling is set to that clipping ceiling.

Yes

Yes

Yes

eluLayer (Deep Learning Toolbox)

An ELU activation layer performs the identity operation on positive inputs and an exponential nonlinearity on negative inputs.

Yes

Yes

No

leakyReluLayer (Deep Learning Toolbox)

A leaky ReLU layer performs a threshold operation, where a input value less than zero is multiplied by a fixed scalar.

Yes

Yes

Yes

reluLayer (Deep Learning Toolbox)

A ReLU layer performs a threshold operation to each element of the input, where a value less than zero is set to zero.

Yes

Yes

Yes

gelu (Deep Learning Toolbox)

A GELU layer weights the input by its probability under a Gaussian distribution.

Yes

Yes

Yes

softplusLayer (Reinforcement Learning Toolbox)

A SoftplusLayer is a deep neural network layer that implements the softplus activation Y = log(1 + eX), which ensures that the output is always positive.

Yes

Yes

No

swishLayer (Deep Learning Toolbox)

A swish activation layer applies the swish function on the layer inputs.

Yes

Yes

No

tanhLayer (Deep Learning Toolbox)

A hyperbolic tangent (tanh) activation layer applies the tanh function on the layer inputs.

Yes

Yes

Yes

Normalization, Dropout, and Cropping Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

batchNormalizationLayer (Deep Learning Toolbox)

A batch normalization layer normalizes each input channel across a mini-batch.

Yes

Yes

Yes

crossChannelNormalizationLayer (Deep Learning Toolbox)

A channel-wise local response (cross-channel) normalization layer carries out channel-wise normalization.

Yes

Yes

Yes

groupNormalizationLayer (Deep Learning Toolbox)

A group normalization layer normalizes a mini-batch of data across grouped subsets of channels for each observation independently.

Yes

Yes

No

layerNormalizationLayer (Deep Learning Toolbox)

A layer normalization layer normalizes a mini-batch of data across all channels for each observation independently.

Yes

Yes

No

crop2dLayer (Deep Learning Toolbox)

A 2-D crop layer applies 2-D cropping to the input.

Yes

Yes

Yes

dropoutLayer (Deep Learning Toolbox)

A dropout layer randomly sets input elements to zero with a given probability.

Yes

Yes

Yes

scalingLayer (Reinforcement Learning Toolbox)

Scaling layer for actor or critic network.

For code generation, values for the 'Scale' and 'Bias' properties must have the same dimension.

Yes

Yes

Yes

Pooling and Unpooling Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

averagePooling2dLayer (Deep Learning Toolbox)

An average pooling layer performs down-sampling by dividing the input into rectangular pooling regions and computing the average values of each region.

You can generate code using the NVIDIA® cuDNN and TensorRT libraries by using the 'mean' setting for the PaddingValue property if the padding size is symmetric.

For Simulink® models that implement deep learning functionality using MATLAB Function block, simulation errors out if the network contains an average pooling layer with non-zero padding value. In such cases, use the blocks from the Deep Neural Networks library instead of a MATLAB Function to implement the deep learning functionality.

Yes

Yes

Yes

globalAveragePooling2dLayer (Deep Learning Toolbox)

A global average pooling layer performs down-sampling by computing the mean of the height and width dimensions of the input.

Yes

Yes

Yes

globalMaxPooling2dLayer (Deep Learning Toolbox)

A global max pooling layer performs down-sampling by computing the maximum of the height and width dimensions of the input.

Yes

Yes

Yes

maxPooling2dLayer (Deep Learning Toolbox)

A max pooling layer performs down-sampling by dividing the input into rectangular pooling regions, and computing the maximum of each region.

If equal max values exists along the off-diagonal in a kernel window, implementation differences for the maxPooling2dLayer might cause minor numerical mismatch between MATLAB® and the generated code. This issue also causes mismatch in the indices of the maximum value in each pooled region. For more information, see maxPooling2dLayer (Deep Learning Toolbox).

Yes

Yes

Yes

maxUnpooling2dLayer (Deep Learning Toolbox)

A max unpooling layer unpools the output of a max pooling layer.

If equal max values exists along the off-diagonal in a kernel window, implementation differences for the maxPooling2dLayer might cause minor numerical mismatch between MATLAB and the generated code. This issue also causes mismatch in the indices of the maximum value in each pooled region. For more information, see maxUnpooling2dLayer (Deep Learning Toolbox).

Yes

Yes

No

Combination Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

additionLayer (Deep Learning Toolbox)

An addition layer adds inputs from multiple neural network layers element-wise.

Yes

Yes

Yes

concatenationLayer (Deep Learning Toolbox)

A concatenation layer takes inputs and concatenates them along a specified dimension.

Yes

Yes

No

depthConcatenationLayer (Deep Learning Toolbox)

A depth concatenation layer takes inputs that have the same height and width and concatenates them along the third dimension (the channel dimension).

Yes

Yes

Yes

Object Detection Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

anchorBoxLayer (Computer Vision Toolbox)

An anchor box layer stores anchor boxes for a feature map used in object detection networks.

Yes

Yes

Yes

depthToSpace2dLayer (Image Processing Toolbox)

A 2-D depth to space layer permutes data from the depth dimension into blocks of 2-D spatial data.

Yes

Yes

Yes

spaceToDepthLayer (Image Processing Toolbox)

A space to depth layer permutes the spatial blocks of the input into the depth dimension. Use this layer when you need to combine feature maps of different size without discarding any feature data.

Yes

Yes

Yes

ssdMergeLayer (Computer Vision Toolbox)

An SSD merge layer merges the outputs of feature maps for subsequent regression and classification loss computation.

Yes

Yes

No

yolov2ReorgLayer (Computer Vision Toolbox)

Create reorganization layer for YOLO v2 object detection network.

Yes

Yes

Yes

yolov2TransformLayer (Computer Vision Toolbox)

Create transform layer for YOLO v2 object detection network.

Yes

Yes

Yes

rcnnBoxRegressionLayer (Computer Vision Toolbox)

A box regression layer refines bounding box locations by using a smooth L1 loss function. Use this layer to create a Fast or Faster R-CNN object detection network.

Yes

Yes

Yes

focalLossLayer (Computer Vision Toolbox)

A focal loss layer predicts object classes using focal loss.

Yes

Yes

Yes

rpnClassificationLayer (Computer Vision Toolbox)

A region proposal network (RPN) classification layer classifies image regions as either object or background by using a cross entropy loss function. Use this layer to create a Faster R-CNN object detection network.

Yes

Yes

Yes

yolov2OutputLayer (Computer Vision Toolbox)

Create output layer for YOLO v2 object detection network.

Yes

Yes

Yes

Output Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

classificationLayer (Deep Learning Toolbox)

A classification layer computes the cross entropy loss for multi-class classification problems with mutually exclusive classes.

Yes

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

Yes

focalLossLayer (Computer Vision Toolbox)

A focal loss layer predicts object classes using focal loss.

Yes

Yes

Yes

pixelClassificationLayer (Computer Vision Toolbox)

A pixel classification layer provides a categorical label for each image pixel or voxel.

Yes

Yes

Yes

rcnnBoxRegressionLayer (Computer Vision Toolbox)

A box regression layer refines bounding box locations by using a smooth L1 loss function. Use this layer to create a Fast or Faster R-CNN object detection network.

Yes

Yes

Yes

regressionLayer (Deep Learning Toolbox)

A regression layer computes the half-mean-squared-error loss for regression problems.

Yes

Yes

Yes

rpnClassificationLayer (Computer Vision Toolbox)

A region proposal network (RPN) classification layer classifies image regions as either object or background by using a cross entropy loss function. Use this layer to create a Faster R-CNN object detection network.

Yes

Yes

Yes

sigmoidLayer (Deep Learning Toolbox)

A sigmoid layer applies a sigmoid function to the input.

Yes

Yes

Yes

softmaxLayer (Deep Learning Toolbox)

A softmax layer applies a softmax function to the input.

Yes

Yes

Yes

Output Layer (Deep Learning Toolbox)

Output layers including custom classification or regression output layers created by using nnet.layer.ClassificationLayer or nnet.layer.RegressionLayer.

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

Yes

Custom Keras Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

nnet.keras.layer.ClipLayer (Deep Learning Toolbox)

Clips the input between the upper and lower bounds.

Yes

Yes

No

nnet.keras.layer.FlattenCStyleLayer (Deep Learning Toolbox)

Flatten activations into 1-D assuming C-style (row-major) order.

Yes

Yes

Yes

nnet.keras.layer.GlobalAveragePooling2dLayer (Deep Learning Toolbox)

Global average pooling layer for spatial data.

Yes

Yes

Yes

nnet.keras.layer.PreluLayer (Deep Learning Toolbox)

Parametric rectified linear unit.

Yes

Yes

No

nnet.keras.layer.SigmoidLayer (Deep Learning Toolbox)

Sigmoid activation layer.

Yes

Yes

Yes

nnet.keras.layer.TanhLayer (Deep Learning Toolbox)

Hyperbolic tangent activation layer.

Yes

Yes

Yes

nnet.keras.layer.TimeDistributedFlattenCStyleLayer (Deep Learning Toolbox)

Flatten a sequence of input image into a sequence of vector, assuming C-style (or row-major) storage ordering of the input layer.

Yes

Yes

No

nnet.keras.layer.ZeroPadding2dLayer (Deep Learning Toolbox)

Zero padding layer for 2-D input.

Yes

Yes

Yes

Custom ONNX Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

nnet.onnx.layer.ClipLayer (Deep Learning Toolbox)

Clips the input between the upper and lower bounds.

Yes

Yes

No

nnet.onnx.layer.ElementwiseAffineLayer (Deep Learning Toolbox)

Layer that performs element-wise scaling of the input followed by an addition.

Yes

Yes

Yes

nnet.onnx.layer.FlattenInto2dLayer (Deep Learning Toolbox)

Flattens a MATLAB 2D image batch in the way ONNX does, producing a 2D output array with CB format.

Yes

Yes

No

nnet.onnx.layer.FlattenLayer (Deep Learning Toolbox)

Flattens the spatial dimensions of the input tensor to the channel dimensions.

Yes

Yes

Yes

nnet.onnx.layer.GlobalAveragePooling2dLayer (Deep Learning Toolbox)

Global average pooling layer for spatial data.

Yes

Yes

Yes

nnet.onnx.layer.IdentityLayer (Deep Learning Toolbox)

Layer that implements ONNX identity operator.

Yes

Yes

Yes

nnet.onnx.layer.PreluLayer (Deep Learning Toolbox)

Parametric rectified linear unit.

Yes

Yes

No

nnet.onnx.layer.SigmoidLayer (Deep Learning Toolbox)

Sigmoid activation layer.

Yes

Yes

Yes

nnet.onnx.layer.TanhLayer (Deep Learning Toolbox)

Hyperbolic tangent activation layer.

Yes

Yes

Yes

nnet.onnx.layer.VerifyBatchSizeLayer (Deep Learning Toolbox)

Verify fixed batch size.

Yes

Yes

Yes

Custom Layers

Layer NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU

Custom layers

Custom layers, with or without learnable parameters, that you define for your problem.

To learn how to define custom deep learning layers, see Define Custom Deep Learning Layers (Deep Learning Toolbox) and Define Custom Deep Learning Layer for Code Generation (Deep Learning Toolbox).

For an example on how to generate code for a network with custom layers, see Code Generation for Object Detection Using YOLO v3 Deep Learning Network.

The outputs of the custom layer must be fixed-size arrays.

Using 'unified' as the MallocMode in coder.gpuConfig requires extra memory copies leading to slower performance. For custom layers, it is recommended to use 'discrete' mode. For more information on GPU memory allocation, see Discrete and Managed Modes

cuDNN targets support both row-major and column-major code generation for custom layers. TensorRT targets support only column-major code generation.

For code generation, custom layers must contain the %#codegen pragma.

Code generation for a sequence network containing custom layer and LSTM or GRU layer is not supported.

You can pass dlarray to custom layers if:

  • The custom layer is in dlnetwork.

  • Custom layer is in a DAG or series network and either inherits from nnet.layer.Formattable or has no backward propagation.

For unsupported dlarray methods, then you must extract the underlying data from the dlarray, perform the computations and reconstruct the data back into the dlarray for code generation. For example,

function Z = predict(layer, X)

if coder.target('MATLAB')
   Z = doPredict(X);
else
   if isdlarray(X)
      X1 = extractdata(X);
      Z1 = doPredict(X1);
      Z = dlarray(Z1);
  else
      Z = doPredict(X);
  end
end

end

Yes

Yes

No

Supported Classes

The following classes are supported for code generation by GPU Coder for the target deep learning libraries specified in the table.

NameDescriptioncuDNNTensorRTARM Compute Library for Mali GPU
DAGNetwork (Deep Learning Toolbox)

Directed acyclic graph (DAG) network for deep learning

  • Only the activations, predict, and classify methods are supported.

Yes

Yes

Yes

dlnetwork (Deep Learning Toolbox)

Deep learning network for custom training loops

  • Code generation supports only the InputNames and OutputNames properties.

  • The Initialized property of the dlnetwork object must be set to true.

  • You can generate code for dlnetwork that have vector and image sequence inputs. Code generation support includes:

    • dlarray containing vector sequences that have 'CT' or 'CBT' data formats.

    • dlarray containing image sequences that have 'SSCT' or 'SSCBT' data formats.

    • Multi-input dlnetwork with heterogeneous input layers. For RNN networks, multiple input is not supported.

    • dlarray inputs with a variable-size time (T) dimension. You use such dlarray objects to represent time series data of variable sequence length.

  • Code generation supports only the predict object function. The dlarray input to the predict method must be a single datatype.

  • Code generation supports dlnetwork for cuDNN, ARM Cortex-A and TensorRT targets. Code generation does not support dlnetwork for ARM Mali targets.

  • When targeting TensorRT with INT8 precision, the last layer(s) of the network must be a softmaxLayer layer.

  • Code generation supports MIMO dlnetworks.

  • To create a dlnetwork object for code generation, see Load Pretrained Networks for Code Generation.

Yes

Yes

No

pointPillarsObjectDetector (Lidar Toolbox)

PointPillars network to detect objects in lidar point clouds

  • Only the detect (Lidar Toolbox) method of the pointPillarsObjectDetector is supported for code generation.

  • Only the Threshold, SelectStrongest, and MiniBatchSize Name-Value pairs of the detect method are supported.

Yes

Yes

No

SeriesNetwork (Deep Learning Toolbox)

Series network for deep learning

  • Only the activations, classify, predict, predictAndUpdateState, classifyAndUpdateState, and resetState object functions are supported.

Yes

Yes

Yes

ssdObjectDetector (Computer Vision Toolbox)

Detect objects using the SSD-based detector.

  • Only the detect (Computer Vision Toolbox) method of the ssdObjectDetector is supported for code generation.

  • The roi argument to the detect method must be a codegen constant (coder.const()) and a 1x4 vector.

  • Only the Threshold, SelectStrongest, MinSize, MaxSize, and MiniBatchSize Name-Value pairs are supported. All Name-Value pairs must be compile-time constants.

  • The channel and batch size of the input image must be fixed size.

  • The labels output is returned as a categorical array.

  • In the generated code, the input is rescaled to the size of the input layer of the network. But the bounding box that the detect method returns is in reference to the original input size.

  • The bounding boxes might not numerically match the simulation results.

Yes

Yes

No

yolov2ObjectDetector (Computer Vision Toolbox)

Detect objects using YOLO v2 object detector

  • Only the detect (Computer Vision Toolbox) method of the yolov2ObjectDetector is supported for code generation.

  • The roi argument to the detect method must be a codegen constant (coder.const()) and a 1x4 vector.

  • Only the Threshold, SelectStrongest, MinSize, MaxSize, and MiniBatchSize Name-Value pairs are supported.

  • The height, width, channel, and batch size of the input image must be fixed size.

  • The minimum batch size value passed to detect method must be fixed size.

Yes

Yes

Yes

yolov3ObjectDetector (Computer Vision Toolbox)

Detect objects using YOLO v3 object detector

  • Only the detect (Computer Vision Toolbox) method of the yolov3ObjectDetector is supported for code generation.

  • The roi argument to the detect method must be a codegen constant (coder.const()) and a 1x4 vector.

  • Only the Threshold, SelectStrongest, MinSize, MaxSize, and MiniBatchSize Name-Value pairs are supported.

  • The height, width, channel, and batch size of the input image must be fixed size.

  • The minimum batch size value passed to detect method must be fixed size.

Yes

Yes

No

yolov4ObjectDetector (Computer Vision Toolbox)

Detect objects using YOLO v4 object detector

  • Only the detect (Computer Vision Toolbox) method of the yolov3ObjectDetector is supported for code generation.

  • The roi argument to the detect method must be a code generation constant (coder.const()) and a 1x4 vector.

  • Only the Threshold, SelectStrongest, MinSize, MaxSize, and MiniBatchSize name-value pairs for detect are supported.

Yes

Yes

No

yoloxObjectDetector (Computer Vision Toolbox)

Detect objects using YOLOX object detector

  • To prepare a yoloxObjectDetector object for GPU code generation, use vision.loadYOLOXObjectDetector (Computer Vision Toolbox).

  • The roi argument to the detect method must be a code generation constant (coder.const()) and a 1x4 vector.

  • The AutoResize argument to the detect method must be a code generation constant (coder.const()).

  • Only the Threshold, SelectStrongest, MinSize, MaxSize, and MiniBatchSize, and AutoResize name-value pairs for detect are supported.

Yes

Yes

No

Usage Notes and Limitations

The code generator represents characters in an 8-bit ASCII codeset that the locale setting determines. Therefore, the use of non-ASCII characters in class names, layer names, layer description, or network names might result in errors. For more information, see Encoding of Characters in Code Generation.

See Also

Functions

Objects

Related Topics