You are reading immutable version 2. The current guide may be newer.

Study the paper

Deep Residual Learning for Image Recognition

Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.

All activities

Mathematical Formulation and Shortcut Connections

Identity Shortcut Connection

Identity Shortcut Connection

Source equation

y=F(x,{Wi})+x.\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}.

This equation defines the fundamental identity shortcut connection in Deep Residual Learning. Instead of forcing stacked layers to directly fit a desired underlying mapping, the network is reformulated to let these layers fit a residual mapping F(x,{Wi})\mathcal{F}(\mathbf{x}, \{W_i\}). The original input x\mathbf{x} is added directly to the output of the residual function via a shortcut connection.

Sources

S3.E1

𝐲=ℱ​(𝐱,{Wi})+𝐱.𝐲ℱ𝐱subscript𝑊𝑖𝐱\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}. (1)
\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}.

y=F(x,{Wi})+x.\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}.

Sources

S3.E1

𝐲=ℱ​(𝐱,{Wi})+𝐱.𝐲ℱ𝐱subscript𝑊𝑖𝐱\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}. (1)
\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}.

The identity shortcut connection adds no extra parameters or computational complexity to the network. It allows gradients to flow directly back through the shortcut connection, mitigating the vanishing gradient problem in extremely deep networks.

Sources

S3.E1

𝐲=ℱ​(𝐱,{Wi})+𝐱.𝐲ℱ𝐱subscript𝑊𝑖𝐱\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}. (1)
\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}.

Illustrative Toy Calculation

Let us consider a simple 1D case where:

  • Input x=[2.0]\mathbf{x} = [2.0]
  • Weights {Wi}\{W_i\} represent a single scaling factor W=[0.5]W = [0.5]
  • The residual function is a simple linear transformation: F(x,{Wi})=Wx=0.5×2.0=1.0\mathcal{F}(\mathbf{x}, \{W_i\}) = W \cdot \mathbf{x} = 0.5 \times 2.0 = 1.0

Applying the identity shortcut connection: y=F(x,{Wi})+x=1.0+2.0=3.0\mathbf{y} = \mathcal{F}(\mathbf{x}, \{W_i\}) + \mathbf{x} = 1.0 + 2.0 = 3.0

Sources

S3.E1

𝐲=ℱ​(𝐱,{Wi})+𝐱.𝐲ℱ𝐱subscript𝑊𝑖𝐱\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}. (1)
\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+\mathbf{x}.
y\mathbf{y}
Output vector of the residual block · Vector of dimension D
x\mathbf{x}
Input vector to the residual block · Vector of dimension D
F\mathcal{F}
Residual mapping function to be learned · Function mapping R^D to R^D
{Wi}\{W_{i}\}
Set of weights associated with the layers in the residual block · Set of weight matrices