Study the paper
Deep Residual Learning for Image Recognition
Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.
Mathematical Formulation of ResNets
Identity Shortcut Connection
Identity Shortcut Connection
Source equation
The fundamental formulation of deep residual learning introduces an identity shortcut connection. Instead of forcing stacked layers to directly fit a desired underlying mapping , we let these layers approximate a residual mapping . The original mapping is recast into .
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}Deep dive
This formulation allows the network to pass the input directly through the shortcut connection, requiring the weight layers to only learn the residual modification . If the identity mapping is optimal, the weights can simply be driven to zero, which is easier than learning an identity mapping from scratch using stacked non-linear layers.
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 the output for a single-channel 2D vector input and a simple linear residual function .
Given:
- Input vector:
- Weight matrix:
Step-by-step calculation:
- Compute the residual mapping :
- Add the identity 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}- Output vector of the residual block · vector
- Input vector to the residual block · vector
- Residual mapping function to be learned by the stacked layers · function
- Set of weights associated with the stacked layers in the block · set of matrices