Study the paper
Deep Residual Learning for Image Recognition
Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.
Mathematics of Identity Shortcuts and Dimension Matching
Residual Block with Identity Shortcut
Residual Block with Identity Shortcut
Source equation
This equation defines the fundamental formulation of a residual learning block. Instead of directly fitting an underlying mapping with a stack of layers, the network is designed to approximate a residual mapping . The original mapping is recast into , which is realized by a feedforward neural network with shortcut connections.
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}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 formulation adds the input vector directly to the output of the residual function . This identity shortcut connection introduces neither extra parameters nor computational complexity, allowing the network to be trained end-to-end via backpropagation.
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}Implementation detail
Illustrative Numerical Example
Let us compute a forward pass for a single-channel 1D feature vector:
- Input vector:
- Residual function:
Applying the residual formula:
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}- Output vector of the residual block · D-dimensional vector
- Input vector to the residual block · D-dimensional vector
- Residual mapping function to be learned · Function mapping from D-dimensional space to D-dimensional space
- Set of weights associated with the layers in the residual block · Set of weight matrices