Study the paper
Deep Residual Learning for Image Recognition
Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.
Mathematical Formulation of Residual Learning
Residual Building Block with Identity Mapping
Residual Building Block with Identity Mapping
Source equation
This equation defines the fundamental building block of Deep Residual Learning (ResNet). 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 via an 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}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}equation
𝐲=ℱ(𝐱,{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 back the input to the output of the residual function . This operation requires no extra parameters and introduces no computational complexity beyond element-wise addition.
Sources
equation
𝐲=ℱ(𝐱,{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 Example
Let us compute a simple forward pass for a single-channel 2D vector input:
- Input vector:
- Residual function:
- Weights:
Step 1: Compute :
Step 2: Apply ReLU activation:
Step 3: Compute residual mapping :
Step 4: 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 · [D]
- Input vector to the residual block · [D]
- Residual mapping function to be learned · [D] -> [D]
- Set of weight matrices associated with the layers in the block · List of [D_out, D_in]