Study the paper
Deep Residual Learning for Image Recognition
Lessons, visuals, quizzes, flashcards, and resources—organized in teaching order.
Dimension Matching and Projection Shortcuts
Residual Building Block with Projection Shortcut
Residual Building Block with Projection Shortcut
Source equation
This equation defines a residual building block with a projection shortcut. When the input dimension of differs from the output dimension of the residual function , a linear projection matrix is applied to the shortcut connection to match the dimensions.
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}Illustrative Calculation
Let us compute a deterministic example where the input vector is 2-dimensional and the output is 3-dimensional.
- Input vector:
- Residual function output:
- Projection matrix:
First, we compute the projection shortcut :
Next, we add the residual function output to the projected shortcut:
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 weight matrices associated with the residual layers · Set of matrices
- Linear projection matrix used to match dimensions of the shortcut connection to the output · [D_{out}, D_{in}]