Javatpoint Logo
Javatpoint Logo

ResNet: Residual Network

ResNet (short for Residual Network) is a type of neural network architecture introduced in 2015 by Kaiming He, Xiangyu Zhang, Shaoqing Ren, and Jian Sun from Microsoft Research. It was designed to solve the problem of vanishing gradients in deep neural networks, which hindered their performance on large-scale image recognition tasks.

This tutorial will discuss the ResNet architecture in detail, including its history, key features, and applications in various domains.

The ResNet architecture is usually divided into four parts, each containing multiple residual blocks with different depths. The first part of the Network comprises a single convolutional layer, followed by max pooling, to reduce the spatial dimensions of the input. The second part of the Network contains 64 filters, while the third and fourth parts contain 128 and 256 filters, respectively. The final part of the Network consists of global average pooling and a fully connected layer that produces the output.


Deep neural networks have revolutionized the field of computer vision by achieving state-of-the-art results on various tasks such as image classification, object detection, and semantic segmentation. However, training deep neural networks can be challenging due to the problem of vanishing gradients.

The vanishing gradient problem occurs when the gradients become too small during backpropagation, which leads to slow convergence and poor performance of the Network. This problem becomes more severe as the depth of the Network increases, and traditional methods such as weight initialization and batch normalization are insufficient to overcome it.

Residual Learning

Residual learning is a concept that was introduced in the ResNet architecture to tackle the vanishing gradient problem. In traditional deep neural networks, each layer applies a set of transformations to the input to obtain the output. ResNet introduces residual connections that enable the Network to learn residual mappings, which are the differences between the input and output of a layer.

The residual connections are formed by adding the input to the output of a layer, which allows the gradients to flow directly through the Network without being attenuated. This enables the Network to learn the residual mapping using a shortcut connection that bypasses the layer's transformation.

ResNet Architecture

The ResNet architecture consists of several layers, each containing residual blocks. A residual block is a set of layers that perform a set of transformations on the input to obtain the output and includes a shortcut connection that adds the input to the output.

The ResNet architecture has several variants, including ResNet-18, ResNet-34, ResNet-50, ResNet-101, and ResNet-152. The number in each variant corresponds to the number of layers in the Network. For example, ResNet-50 has 50 layers, while ResNet-152 has 152 layers.

The ResNet-50 architecture is one of the most popular variants, and it consists of five stages, each containing several residual blocks. The first stage consists of a convolutional layer followed by a max-pooling layer, which reduces the spatial dimensions of the input.

The second stage contains three residual blocks, each containing two convolutional layers and a shortcut connection. The third, fourth, and fifth stages contain four, six, and three residual blocks, respectively. Each block in these stages contains several convolutional layers and a shortcut connection.

The output of the last stage is fed into a global average pooling layer, which reduces the spatial dimensions of the feature maps to a single value for each channel. The output of the global average pooling layer is then fed into a fully connected layer with softmax activation, which produces the final output of the Network.


ResNet has achieved state-of-the-art results on various computer vision tasks, including image classification, object detection, and semantic segmentation. In the ImageNet Large Scale Visual Recognition Challenge (ILSVRC) 2015, the ResNet-152 architecture achieved a top-5 error rate of 3.57%, significantly better than the previous state-of-the-art error rate of 3.57%.

Benefits of ResNet

ResNet has several benefits that make it a popular choice for deep learning applications:

  • Deeper networks

ResNet enables the construction of deeper neural networks, with more than a hundred layers, which was previously impossible due to the vanishing gradient problem. The residual connections allow the Network to learn better representations and optimize the gradient flow, making it easier to train deeper networks.

  • Improved accuracy

ResNet has achieved state-of-the-art performance on several benchmark datasets, such as ImageNet, CIFAR-10, and CIFAR-100, demonstrating its superior accuracy compared to other deep neural network architectures.

  • Faster convergence

ResNet enables faster convergence during training, thanks to the residual connections that allow for better gradient flow and optimization. This results in faster training and better convergence to the optimal solution.

  • Transfer learning

ResNet is suitable for transfer learning, allowing the Network to reuse previously

learned features for new tasks. This is especially useful in scenarios where the amount of Labeled data is limited, as the pre-trained ResNet can be fine-tuned on the new dataset to achieve good performance.

Drawbacks of ResNet

Despite its numerous benefits, ResNet has a few drawbacks that should be considered:

  • Complexity

ResNet is a complex architecture that requires more memory and computational resources than shallower networks. This can be a limitation in scenarios with limited resources, such as mobile devices or embedded systems.

  • Overfitting

ResNet can be prone to overfitting, especially when the Network is too deep or when the dataset is small. This can be mitigated by regularization techniques, such as dropout, or by using smaller networks with fewer layers.

  • Interpretability

ResNet's interpretability can be challenging, as the Network learns complex and abstract representations that are difficult to understand. This can be a limitation in scenarios where interpretability is crucial, such as medical diagnosis or fraud detection.


ResNet is a powerful deep neural network architecture that has revolutionized the field of computer vision by enabling the construction of deeper and more accurate networks. Its residual connections enable better gradient flow and optimization, making training deeper networks easier and achieving better performance on benchmark datasets.

However, ResNet has limitations, such as complexity, susceptibility to overfitting, and limited interpretability. When choosing ResNet or any other deep neural network architecture for a specific task, these drawbacks should be considered.

Overall, ResNet has significantly impacted deep learning and computer vision, and its principles have been extended to other domains, such as natural language processing and speech recognition. As research in deep learning continues to evolve, new architectures and techniques will likely be developed to address the current limitations of ResNet and other existing architectures.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA