Study the paper
Deep Residual Learning for Image Recognition
Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.
Mathematical Formulation of ResNets
Projection Shortcut Connection
Projection Shortcut Connection
Source equation
This equation defines the projection shortcut connection in Deep Residual Networks (ResNets). When the input dimension and output dimension of a residual block differ, a linear projection matrix is applied to the input to match the dimensions of the residual function .
Sources
S3.E2
𝐲=ℱ(𝐱,{Wi})+Ws𝐱.𝐲ℱ𝐱subscript𝑊𝑖subscript𝑊𝑠𝐱\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+W_{s}\mathbf{x}. (2)
\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+W_{s}\mathbf{x}Sources
S3.E2
𝐲=ℱ(𝐱,{Wi})+Ws𝐱.𝐲ℱ𝐱subscript𝑊𝑖subscript𝑊𝑠𝐱\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+W_{s}\mathbf{x}. (2)
\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+W_{s}\mathbf{x}The projection shortcut connection ensures that the dimensions of the shortcut path match the dimensions of the residual path, allowing element-wise addition.
Sources
S3.E2
𝐲=ℱ(𝐱,{Wi})+Ws𝐱.𝐲ℱ𝐱subscript𝑊𝑖subscript𝑊𝑠𝐱\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+W_{s}\mathbf{x}. (2)
\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+W_{s}\mathbf{x}Implementation detail
Illustrative Example
Let us consider a simple deterministic example where the input vector has dimension 2, and the output has dimension 3.
- Input vector:
- Residual function output:
- Projection matrix:
Step 1: Compute the projection of the input
Step 2: Add the residual function output
Sources
S3.E2
𝐲=ℱ(𝐱,{Wi})+Ws𝐱.𝐲ℱ𝐱subscript𝑊𝑖subscript𝑊𝑠𝐱\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+W_{s}\mathbf{x}. (2)
\mathbf{y}=\mathcal{F}(\mathbf{x},\{W_{i}\})+W_{s}\mathbf{x}- Output vector of the residual block · [D_{out}]
- Input vector to the residual block · [D_{in}]
- Residual mapping function to be learned · [D_{out}]
- Set of weights associated with the residual layers · variable
- Linear projection matrix used to match dimensions · [D_{out}, D_{in}]