Main Content

Create 3-D residual network

creates a 3-D residual network with an image input size specified by
`lgraph`

= resnet3dLayers(`inputSize`

,`numClasses`

)`inputSize`

and a number of classes specified by
`numClasses`

. A residual network consists of stacks of blocks. Each
block contains deep learning layers. The network includes an image classification layer,
suitable for predicting the categorical label of an input image.

To create a 2-D residual network, use `resnetLayers`

.

creates a residual network using one or more name-value arguments using any of the input
arguments in the previous syntax. For example, `lgraph`

= resnet3dLayers(___,`Name=Value`

)`InitialNumFilters=32`

specifies 32 filters in the initial convolutional layer.

When working with small images, set the

`InitialPoolingLayer`

option to`"none"`

to remove the initial pooling layer and reduce the amount of downsampling.Residual networks are usually named ResNet-

*X*, where*X*is the*depth*of the network. The depth of a network is defined as the largest number of sequential convolutional or fully connected layers on a path from the input layer to the output layer. You can use the following formula to compute the depth of your network:$$\text{depth=}\{\begin{array}{c}1+2{\displaystyle \sum}_{i=1}^{N}{s}_{i}+1\text{Ifnobottleneck}\\ 1+3{\displaystyle \sum}_{i=1}^{N}{s}_{i}+1\text{Ifbottleneck}\end{array}\text{,}$$

where

*s*is the depth of stack_{i}*i*.Networks with the same depth can have different network architectures. For example, you can create a 3-D ResNet-14 architecture with or without a bottleneck:

The relationship between bottleneck and nonbottleneck architectures also means that a network with a bottleneck will have a different depth than a network without a bottleneck.resnet14Bottleneck = resnet3dLayers([224 224 64 3],10, ... StackDepth=[2 2], ... NumFilters=[64 128]); resnet14NoBottleneck = resnet3dLayers([224 224 64 3],10, ... BottleneckType="none", ... StackDepth=[2 2 2], ... NumFilters=[64 128 256]);

resnet50Bottleneck = resnet3dLayers([224 224 64 3],10); resnet34NoBottleneck = resnet3dLayers([224 224 64 3],10, ... BottleneckType="none");

[1] He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. “Deep Residual Learning for Image Recognition.” Preprint, submitted December 10, 2015. https://arxiv.org/abs/1512.03385.

[2] He, Kaiming, Xiangyu Zhang, Shaoqing Ren, and Jian Sun. “Identity Mappings in Deep Residual Networks.” Preprint, submitted July 25, 2016. https://arxiv.org/abs/1603.05027.

[3] He, Kaiming, Xiangyu Zhang,
Shaoqing Ren, and Jian Sun. "Delving Deep into Rectifiers: Surpassing Human-Level Performance
on ImageNet Classification." In *Proceedings of the 2015 IEEE
International Conference on Computer Vision*, 1026–1034. Washington, DC: IEEE
Computer Vision Society, 2015.

`resnetLayers`

| `trainNetwork`

| `trainingOptions`

| `dlnetwork`

| `resnet18`

| `resnet50`

| `resnet101`