
Source: “Deep Residual Learning for Image Recognition” Paper by He et al., 2016
Introduction
ResNet (Residual Network) is a convolutional neural network architecture introduced by Kaiming He et al. at Microsoft Research in their 2015 paper “Deep Residual Learning for Image Recognition” [1]. The architecture won first place in the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) 2015 with a 3.57% top-5 error rate, using a network with 152 layers, eight times deeper than VGG nets [2] but with lower computational complexity.
Before ResNet, training very deep networks was considered impractical. Networks with more than 20-30 layers would often perform worse than their shallower counterparts, not due to overfitting, but due to optimization difficulties. ResNet solved this problem with a simple yet profound innovation: skip connections (also called residual connections) that allow gradients to flow directly through the network.
The influence of ResNet extends far beyond image classification. The residual connection design has become a fundamental building block in modern deep learning, appearing in architectures as diverse as Transformers [3], BERT, GPT, and diffusion models. Understanding ResNet is essential for anyone working with deep neural networks.
The Degradation Problem
Before examining ResNet’s solution, we must understand the problem it solves. In theory, a deeper network should perform at least as well as a shallower one. If the additional layers are not needed, they could simply learn the identity function (output equals input), effectively reducing to the shallower network.
In practice, this does not happen. Researchers observed a counterintuitive phenomenon: adding more layers to a network often made it perform worse, even on training data. This is not overfitting, since training error also increases. He et al. termed this the degradation problem.

Source: “Deep Residual Learning for Image Recognition” Paper by He et al., 2016
This finding was surprising because it contradicted the intuition that more layers should provide more representational power. ResNet’s key insight was that the problem was not with depth itself, but with how deep networks were being optimized.
Residual Learning: The Core Innovation
ResNet addresses the degradation problem by reformulating the learning objective. Instead of asking each layer to learn a desired mapping H(x), ResNet asks layers to learn the residual F(x) = H(x) – x. The output becomes:
This is implemented by adding a skip connection that bypasses one or more layers and adds the input directly to the output. If the optimal transformation is close to identity, the network only needs to learn F(x) ≈ 0, which is much easier than learning a full identity mapping.
For a detailed explanation of how residual connections solve the vanishing gradient problem, see the article on residual connections.
ResNet Architecture Variants
ResNet comes in several sizes, distinguished by the number of layers: ResNet-18, ResNet-34, ResNet-50, ResNet-101, and ResNet-152. The architecture follows a consistent pattern across all variants, differing primarily in the number of residual blocks at each stage.
The BasicBlock (ResNet-18 and ResNet-34)
ResNet-18 and ResNet-34 use the BasicBlock as their fundamental building unit. Each BasicBlock contains two 3×3 convolutional layers with batch normalization:
class BasicBlock(nn.Module):
"""Basic residual block for ResNet-18/34."""
expansion = 1
def __init__(self, in_channels, out_channels, stride=1, downsample=None):
super().__init__()
self.conv1 = nn.Conv2d(in_channels, out_channels, kernel_size=3,
stride=stride, padding=1, bias=False)
self.bn1 = nn.BatchNorm2d(out_channels)
self.conv2 = nn.Conv2d(out_channels, out_channels, kernel_size=3,
stride=1, padding=1, bias=False)
self.bn2 = nn.BatchNorm2d(out_channels)
self.downsample = downsample
def forward(self, x):
identity = x
out = F.relu(self.bn1(self.conv1(x)))
out = self.bn2(self.conv2(out))
if self.downsample is not None:
identity = self.downsample(x)
out += identity # The skip connection
return F.relu(out)The downsample parameter handles cases where the input and output dimensions differ. When the number of channels increases or spatial dimensions decrease (via stride > 1), a 1×1 convolution projects the input to match the output dimensions, allowing the addition to proceed.
The Bottleneck Block (ResNet-50 and deeper)
The bottleneck design reduces computational cost while maintaining representational capacity, making very deep networks practical.
| Block Type | Layers | Parameters (64 channels) | Computational Cost |
|---|---|---|---|
| BasicBlock | 2 x 3x3 conv | 73,728 | 73,728 multiplies |
| Bottleneck | 1x1 + 3x3 + 1x1 | 69,632 | 69,632 multiplies |
Source: Deep Residual Learning for Image Recognition Paper by He et al.
ResNet-18 Layer Organization
ResNet-18 consists of an initial convolution followed by four stages of residual blocks:
| Stage | Output Size | Structure | Channels |
|---|---|---|---|
| Conv1 | 112 x 112 | 7x7 conv, stride 2 | 64 |
| MaxPool | 56 x 56 | 3x3 max pool, stride 2 | 64 |
| Stage 1 | 56 x 56 | 2 BasicBlocks | 64 |
| Stage 2 | 28 x 28 | 2 BasicBlocks | 128 |
| Stage 3 | 14 x 14 | 2 BasicBlocks | 256 |
Source: Deep Residual Learning for Image Recognition Paper by He et al.
The total layer count comes from: 1 (initial conv) + 16 (eight BasicBlocks, each with 2 conv layers) + 1 (fully connected) = 18 layers. Hence the name ResNet-18.
Plain Network vs ResNet: Experimental Evidence
The original paper included a critical experiment comparing plain networks (without skip connections) to ResNets of equivalent depth. The results demonstrated the degradation problem and ResNet’s solution:
Plain Networks:
- 18-layer plain network: achieves reasonable performance
- 34-layer plain network: higher training AND test error than 18-layer
- Demonstrates degradation problem in action
Residual Networks:
- 18-layer ResNet: comparable to 18-layer plain
- 34-layer ResNet: lower error than 18-layer ResNet
- Deeper networks consistently improve performance
Performance on ImageNet
| Model | Layers | Top-1 Error | Top-5 Error | Parameters |
|---|---|---|---|---|
| VGG-19 | 19 | 24.40% | 7.10% | 144M |
| ResNet-18 | 18 | 27.90% | 9.00% | 11.7M |
| ResNet-34 | 34 | 24.50% | 7.40% | 21.8M |
| ResNet-50 | 50 | 22.90% | 6.70% | 25.6M |
| ResNet-152 | 152 | 21.40% | 5.70% | 60.2M |
Note that ResNet-152 achieves better performance than VGG-19 with fewer parameters.
Source: Deep Residual Learning for Image Recognition Paper by He et al.
This experiment proved that skip connections, not just careful initialization or batch normalization, were essential for training very deep networks. The plain networks used the same training procedures, learning rates, and regularization as the ResNets, isolating the effect of the residual connections.
Legacy and Impact
ResNet’s influence extends far beyond image classification:
Training Ultra-Deep Networks: ResNet enabled training of networks with 100, 200, and even 1000+ layers, demonstrating that depth could be scaled almost arbitrarily with proper architecture design.
Foundation for Modern Architectures: The residual connection design appears in virtually every modern deep learning architecture. Transformers [3] use residual connections around both self-attention and feed-forward layers. Without these connections, training large language models like GPT and BERT would be impractical.
Transfer Learning Backbone: Pre-trained ResNet models became the standard backbone for transfer learning in computer vision. Features learned on ImageNet transfer effectively to tasks ranging from medical imaging to autonomous driving.
Architectural Experimentation: ResNet inspired numerous variants including ResNeXt (grouped convolutions), Wide ResNet (wider layers, fewer depth), DenseNet (dense connections), and SE-ResNet (channel attention).
Summary
The ResNet (Residual Network) architecture, introduced in 2015, revolutionized deep learning by enabling the practical training of ultra-deep convolutional neural networks.
The core problem ResNet solved was the degradation problem, where simply adding more layers to a network led to worse performance, even on training data. ResNet addressed this through the introduction of residual connections. Instead of forcing layers to learn a difficult direct mapping, ResNet reformulates the objective to learn a residual mapping F(x) = H(x) – x. If optimal learning is close to the identity function, the network only needs to learn $F(x) \approx 0$, which is significantly easier to optimize.
The architecture comes in various depths (e.g., ResNet-18, ResNet-50) utilizing either a BasicBlock (for shallower nets) or a more computationally efficient Bottleneck Block (for deeper nets). ResNet achieved state-of-the-art performance on ImageNet and its foundational residual connection design has since been integrated into nearly every modern deep learning model, including Transformers, making it an essential building block in modern AI.
Video Explanations
- This video, “ResNet – Explained!” by CodeEmporium provides a visual walkthrough of the ResNet architecture, the degradation problem, and how skip connections solve it. (Runtime: 16 mins)
- This video, “Deep Residual Learning for Image Recognition (Paper Explained)” by Yannic Kilcher offers an in-depth 31-minute walkthrough of the original paper, covering experimental results and architectural details. (Runtime: 31 mins)
References
- He, K., Zhang, X., Ren, S., & Sun, J. (2016). “Deep Residual Learning for Image Recognition”. CVPR 2016. arXiv:1512.03385
- Simonyan, K., & Zisserman, A. (2015). “Very Deep Convolutional Networks for Large-Scale Image Recognition” (VGG). ICLR 2015. arXiv:1409.1556
- Vaswani, A., et al. (2017). “Attention Is All You Need”. NeurIPS 2017. arXiv:1706.03762

