Main Content

deeplabv3plusLayers

(To be removed) Create DeepLab v3+ convolutional neural network for semantic image segmentation

Since R2019b

deeplabv3plusLayers will be removed in a future release. Use the deeplabv3plus function instead. For more information, see Compatibility Considerations.

Description

example

layerGraph = deeplabv3plusLayers(imageSize,numClasses,network) returns a DeepLab v3+ layer with the specified base network, number of classes, and image size.

layerGraph = deeplabv3plusLayers(___,"DownsamplingFactor",value) additionally sets the downsampling factor (output stride) [1] to either 8 or 16. The downsampling factor sets the amount the encoder section of DeepLab v3+ downsamples the input image.

Examples

collapse all

Create a DeepLab v3+ network based on ResNet-18.

imageSize = [480 640 3];
numClasses = 5;
network = "resnet18";
lgraph = deeplabv3plusLayers(imageSize,numClasses,network, ...
             "DownsamplingFactor",16);

Display the network.

analyzeNetwork(lgraph)

Input Arguments

collapse all

Network input image size, specified as a:

  • 2-element vector in the format [height, width].

  • 3-element vector in the format [height, width, 3]. The third element, 3, corresponds to RGB.

Number of classes for network to classify, specified as an integer greater than 1.

Base network, specified as resnet18 (Deep Learning Toolbox), resnet50 (Deep Learning Toolbox), mobilenetv2 (Deep Learning Toolbox), xception (Deep Learning Toolbox), or inceptionresnetv2 (Deep Learning Toolbox). You must install the corresponding network add-on.

Output Arguments

collapse all

DeepLab v3+ network, returned as a layerGraph (Deep Learning Toolbox) object for semantic image segmentation. The network uses encoder-decoder architecture, dilated convolutions, and skip connections to segment images. You must use the trainNetwork (Deep Learning Toolbox) function (requires Deep Learning Toolbox™) to train the network before you can use the network for semantic segmentation.

Algorithms

  • When you use either the xception (Deep Learning Toolbox) or mobilenetv2 (Deep Learning Toolbox) base networks to create a DeepLab v3+ network, depth separable convolutions are used in the atrous spatial pyramid pooling (ASPP) and decoder subnetworks. For all other base networks, convolution layers are used.

  • This implementation of DeepLab v3+ does not include a global average pooling layer in the ASPP.

References

[1] Chen, L., Y. Zhu, G. Papandreou, F. Schroff, and H. Adam. "Encoder-Decoder with Atrous Separable Convolution for Semantic Image Segmentation." Computer Vision — ECCV 2018, 833-851. Munic, Germany: ECCV, 2018.

Extended Capabilities

Version History

Introduced in R2019b

collapse all

R2024a: deeplabv3plusLayers will be removed

The deeplabv3plusLayers function will be removed in a future release. Use the deeplabv3plus function instead. The deeplabv3plus function returns a dlnetwork (Deep Learning Toolbox) object, which has these advantages over layerGraph objects:

  • dlnetwork objects support a wider range of network architectures which you can then easily train using the trainnet (Deep Learning Toolbox) function or import from external platforms.

  • dlnetwork objects provide more flexibility. They have wider support with current and upcoming Deep Learning Toolbox functionality.

  • dlnetwork objects provide a unified data type that supports network building, prediction, built-in training, compression, and custom training loops.

  • dlnetwork training and prediction is typically faster than DAGNetwork and SeriesNetwork training and prediction.

To update your code, replace instances of the deeplabv3plusLayers with the deeplabv3plus function. You do not need to change the input arguments.

Discouraged UsageRecommended Replacement

This example uses the deeplabv3plusLayers function to create a DeepLab v3+ network, returned as a LayerGraph object.

imageSize = [480 640 3];
numClasses = 5;
network = "resnet18";
deepLabNetwork = deeplabv3plusLayers(imageSize,numClasses,network, ...
	DownsamplingFactor=16);

Here is equivalent code that instead uses the deeplabv3plus function to create a DeepLab v3+ network, returned as a dlnetwork object.

imageSize = [480 640 3];
numClasses = 5;
network = "resnet18";
deepLabNetwork = deeplabv3plus(imageSize,numClasses,network, ...
	DownsamplingFactor=16);