ResNet

Also known as: Residual network

On this page 7

ResNet, short for residual network, is a family of deep convolutional neural networks in which each block learns a residual function added to its own input through a shortcut, or skip, connection. Introduced in 2015 by Kaiming He and colleagues at Microsoft Research, it made networks of more than 100 layers trainable and became one of the most influential designs in neural networks and in artificial intelligence as a whole.

ResNet won the ILSVRC 2015 image classification challenge and remains a standard baseline and backbone for computer vision. Its central idea, the residual connection, now appears in almost every deep architecture, including the Transformer.

The degradation problem that ResNet solved

ResNet was designed to fix the degradation problem: before 2015, adding layers to a plain convolutional network beyond roughly 20 to 30 layers made training error rise, not fall. This was not overfitting, because the deeper network performed worse even on its own training data.

In theory a deeper network should never be worse, since extra layers could simply learn the identity mapping. In practice, stacks of nonlinear layers trained with gradient descent find identity mappings hard to approximate, and optimization stalls. Batch normalization had already eased the vanishing gradient problem, so the obstacle was primarily one of optimization difficulty.

How a residual block works

A residual block computes y = F(x) + x, where F is a small stack of convolutional layers and x is the block input passed unchanged through a shortcut. The layers therefore learn only the residual F(x) = H(x) – x, the difference between the desired mapping and the input.

If the best mapping is close to identity, the network only needs to push F toward zero, which is easy. During backpropagation the shortcut also provides a direct gradient path, so error signals reach early layers without being repeatedly shrunk by weight matrices and activation functions.

ResNet uses two block types, compared in the table below. The bottleneck design reduces computation in deep variants by compressing channels before the expensive 3×3 convolution.

PropertyBasic blockBottleneck block
Layer sequence3×3 conv, 3×3 conv1×1 conv, 3×3 conv, 1×1 conv
Used inResNet-18 and ResNet-34ResNet-50, ResNet-101, ResNet-152
Channel expansionNoneOutput is 4 times the inner width
Main advantageSimple, fast on small modelsDepth at modest compute cost
Basic and bottleneck residual blocks

When a block changes resolution or channel count, the identity shortcut cannot be added directly. ResNet then uses a projection shortcut, a 1×1 convolution with stride 2, so that both branches have matching tensor shapes.

Standard ResNet variants and their scale

The original ResNet family differs mainly in depth and block type, while sharing the same overall layout. Every variant starts with a 7×7 convolutional stem and max pooling, passes through four stages that halve resolution and widen channels, and ends with global average pooling and one fully connected classifier.

The table shows approximate size, compute and ImageNet top-1 accuracy for the commonly published reference weights. Exact accuracy varies by training recipe, and modern recipes add several points.

VariantParametersCompute per imageTop-1 accuracy
ResNet-18About 11.7 millionAbout 1.8 GFLOPsAbout 70%
ResNet-34About 21.8 millionAbout 3.6 GFLOPsAbout 73%
ResNet-50About 25.6 millionAbout 4.1 GFLOPsAbout 76%
ResNet-101About 44.5 millionAbout 7.8 GFLOPsAbout 77%
ResNet-152About 60.2 millionAbout 11.3 GFLOPsAbout 78%
Reference ResNet variants on ImageNet

ResNet-50 is the most widely used member, because it offers a good balance of accuracy and cost and serves as a common benchmark for hardware and training throughput.

ResNet compared with other architectures

ResNet sits between the plain deep CNNs that preceded it and the attention-based models that followed. The comparison below places it among neighboring designs.

ArchitectureKey mechanismRelation to ResNet
VGGPlain stacks of 3×3 convolutionsEarlier design; deeper versions suffered degradation
ResNet v2Pre-activation blocks with clean identity pathsRefinement that trained 1,000-layer networks
ResNeXtGrouped convolutions inside residual blocksAdds width through parallel paths
DenseNetConcatenates outputs of all earlier layersFeature reuse instead of addition
U-NetEncoder-decoder with long skip connectionsOften uses a ResNet encoder
Vision TransformerSelf-attention over image patchesKeeps residual connections around every sublayer
ResNet and related architectures

The residual connection outlived the original model. Transformers, diffusion U-Nets and state space models all wrap their layers in residual paths, which shows that ResNet contributed a general principle of deep network design, not only a single vision model.

Practical use, limitations and common mistakes

ResNet is used today mostly as a pretrained backbone for transfer learning, for example in object detection, segmentation and medical imaging. Its features are well understood, it runs efficiently on many accelerators, and its behavior is predictable and easy to debug.

The architecture also has known limits. Its receptive field grows only locally, so it captures global context less directly than attention models, and on very large datasets Vision Transformers and ConvNeXt often reach higher accuracy for similar compute.

SymptomLikely causeFix
Poor accuracy after fine-tuningInput not normalized like pretraining dataApply the original mean and standard deviation
Unstable training with small batchesBatch normalization statistics are noisyFreeze BN layers or use group normalization
Overfitting on a tiny datasetToo many trainable parametersFreeze early stages or choose ResNet-18
Slow inference on edge devicesDeep variant chosen by defaultUse a smaller ResNet or a mobile architecture
Common mistakes when using ResNet

A frequent misconception is that residual connections eliminate vanishing gradients entirely. They greatly improve gradient flow and optimization, but deep ResNets still depend on careful weight initialization and normalization to train well.

The idea in brief

ResNet is a way of building very deep image-recognition networks that still learn well. Each small part of the network gets a shortcut that carries its input straight past it. The part only has to learn what to add or change, not rebuild everything from scratch.

Think of editing a document with tracked changes instead of retyping it. If a section is already fine, no edits are needed. This simple trick allowed networks to grow from about 20 layers to more than 150 while becoming more accurate, not less.

A practical scenario

A quality-control team at an electronics factory needs to detect defective solder joints on circuit boards. They have only 6,000 labeled photos, far too few to train a large network from scratch.

The engineers take a ResNet-50 pretrained on ImageNet, replace its final classification layer with a two-class output, freeze the first two stages and fine-tune the rest for 20 epochs. They resize images to 224 by 224 pixels and normalize them with the same statistics used during pretraining.

On a held-out test set the model reaches about 97% accuracy and runs in roughly 10 milliseconds per image on a single inspection GPU. The result shows why ResNet remains a dependable starting point for industrial vision tasks with limited data.