Deep Residual Learning for Image Recognition
- Publication
- CVPR 2016Conference
- First submitted to arXiv
- arXiv:1512.03385
Cite this paper · BibTeX
The citation identifies the linked source version. It cites the original paper and its authors.
@misc{classiccnnsresnet2015,
title = {{Deep Residual Learning for Image Recognition}},
author = {Kaiming He and Xiangyu Zhang and Shaoqing Ren and Jian Sun},
year = {2015},
eprint = {1512.03385},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1512.03385}
}
BatchNorm and suitable initialization made deep networks easier to optimize. Yet the ResNet authors observed something puzzling: adding layers could increase even the training error.
So why are models still difficult to train well?
Defining the Problem
The authors conducted an experiment.
In principle, a deeper model has at least one solution no worse than a shallow one: the added layers can implement identities while the others copy the shallow model. Yet the 56-layer plain network in this CIFAR-10 plot has higher training and test errors than the 20-layer plain network.
The crucial point is that training error also rises, so overfitting alone cannot explain it. The authors inspected signals and gradients in their experiments and did not attribute this degradation directly to vanishing gradients. The question becomes one of optimization: a good solution can be constructed, but training does not find it.
Hence, the authors define this issue as the model degradation problem.
Solving the Problem
What is Residual?
In mathematics and engineering, a residual is the difference between an observed value and a reference value.
Computer vision also uses residual representations of local image descriptors: they encode how a descriptor differs from a reference such as a dictionary or model. This can capture variations, provide a compact way to process them, and help distinguish subtle image features. Those are background uses of the word. In ResNet, the reference is the network block's own input, and the residual branch learns what to add to it.
Residual Learning
Let denote the mapping a residual block should learn, and its input features—not necessarily the raw image.
Rather than directly fitting , the residual branch learns and the sum becomes . Its target is therefore . The desired mapping stays the same; its parameterization changes.
If a suitable mapping is close to the identity, the residual branch only needs to approach zero. This is the authors’ optimization intuition; the experiments test whether it helps.
A shortcut skips one or more layers and adds the block input to the branch output. When shapes match, an identity shortcut adds no trainable parameters, though the addition has a small computational cost. Whether this reparameterization improves optimization is tested against plain networks of the same depth below.
Residual Module
The paper uses both a two-layer basic block and a three-layer bottleneck. The two examples have similar computational complexity; parameter counts require a separate comparison. Other branch depths are possible, but the authors did not observe a benefit from a one-layer residual function.
The two paths must have matching shapes before addition. For dimension changes, the paper compares zero-padding shortcuts with projection shortcuts; projections can also use stride to adjust spatial size. The original block applies ReLU after addition.
Network Architecture
This might be the "longest" image we've seen in a paper...
The figure compares VGG-19, a 34-layer plain network and ResNet-34. The last two have the same depth and backbone but differ in shortcuts. Most convolutions use kernels, following two design rules:
- For the same output feature map size, the stacked convolutional layers should have the same number of output channels.
- If the feature map size is halved, the number of channels is doubled to keep the per-layer convolutional computation at roughly the same scale.
Downsampling is achieved through convolutions with a stride of 2, and the final classification is done using a global average pooling layer followed by a fully connected layer.
In the paper's multiply-add count, the 34-layer network uses about 3.6 billion FLOPs, versus 19.6 billion for VGG-19: roughly 18%. That FLOP ratio is not a measured latency ratio.
Architectures and Computation
The table specifies block configurations and computation. Its FLOP count ranges from 1.8 billion for 18 layers to 11.3 billion for 152 layers, below the paper's 15.3/19.6 billion for VGG-16/19. It does not list parameter counts, so parameter growth cannot be read directly from this table.
Other training configurations are as follows:
-
Data Augmentation:
- Scale Augmentation: The short side of an image is resized to a random size in the range [256, 480] for scale augmentation.
- Crop and Flip: Randomly crop a 224×224 area from the image or its horizontal flip and subtract the mean value of each pixel.
- Color Augmentation: Use standard color augmentation methods detailed in AlexNet.
-
Normalization and Activation:
- Use Batch Normalization (BN) after each convolution and before activation to stabilize and accelerate training.
-
Weight Initialization:
- Use Kaiming initialization to initialize weights, training all plain and residual networks from scratch.
-
Optimizer:
- Use mini-batch Stochastic Gradient Descent as the optimizer with a batch size of 256.
- Learning Rate: Set the initial learning rate to 0.1, dividing it by 10 when the error reaches a stable level.
- Weight Decay: Set to 0.0001.
- Momentum: Set to 0.9.
-
Other Configurations:
- Dropout: Do not use dropout during training.
Discussion
ResNet-18 vs ResNet-34
The authors first evaluated the plain networks with 18 and 34 layers.
The plain network's top-1 validation error rises from 27.94% at 18 layers to 28.54% at 34. With parameter-free shortcuts, ResNet-34 scores 25.03% and ResNet-18 27.88%. Table 2 uses ten crops; the training plot below uses center-crop validation errors.
The figure reveals a degradation problem: although the solution space of the 18-layer plain network is a subset of the 34-layer network, the 34-layer plain network has higher training error throughout the training process. The authors believe this optimization difficulty is unlikely to be caused by gradient vanishing. These plain networks are trained with Batch Normalization (BN), ensuring non-zero variance in forward propagation signals. The authors also checked the backward gradient norms and did not observe vanishing forward or backward signals in these experiments.
In fact, the 34-layer plain network still achieves competitive accuracy, indicating that the solver works to some extent. The authors speculate that the convergence speed of the deep plain network might decrease exponentially, affecting the reduction in training error. Future research will further investigate the causes of this optimization difficulty.
The authors then add shortcuts around each pair of convolutions. Table 2 uses option A: changed dimensions are matched by zero-padding, without extra shortcut weights. ResNet-34's top-1 validation error is 2.85 percentage points lower than ResNet-18's, and Figure 4 also shows lower training error. The evidence supports relief from degradation in this setup.
Deeper Bottleneck Architectures
The authors constructed deeper networks for ImageNet.
Due to training time considerations, the authors modified the building block to a bottleneck design. For each residual function , three layers are stacked instead of two, as shown above.
These three layers are , , and convolutions. The layers are responsible for reducing and then restoring (increasing) dimensions, with the layer functioning as a bottleneck with smaller input/output dimensions. The two designs have similar time complexity.
- ResNet-50: By replacing each 2-layer block with this 3-layer bottleneck block, ResNet-50 is constructed.
- ResNet-101 and ResNet-152: More 3-layer blocks are used to build ResNet-101 and ResNet-152.
Performance on ImageNet
The table above shows the performance of ResNet on ImageNet. The baseline 34-layer ResNet already achieves very competitive accuracy.
As the network depth increases, the 50/101/152-layer ResNets show significant improvements in accuracy over the 34-layer ResNet. No degradation problem is observed, and the benefits of depth are evident across all evaluation metrics.
The ResNet-152 row is a single model on ImageNet validation: 4.49% top-5 error and 19.38% top-1 error. One dagger-marked VGG row is from a test set and is not a matched validation comparison. The unpictured Table 5 instead reports a six-model ensemble's 3.57% top-5 test error, the ILSVRC 2015 competition result; it is not this table's single-model score.
Conclusion
Before ResNet, training ever deeper networks was difficult. Residual learning offered a practical way to improve optimization: in the experiments here, adding shortcuts helped deeper networks avoid the rise in training error seen in their plain counterparts. That made very deep models feasible and quickly made ResNet a reference architecture.
Its success inspired later designs such as DenseNet and ResNeXt, which continued to refine network structure and performance.
ResNet backbones later appeared in applications such as medical imaging, autonomous driving and surveillance. Those uses show the reach of the design, although this paper's own evidence comes from its image-recognition experiments.