Study the paper
Deep Residual Learning for Image Recognition
Lessons, visuals, quizzes, flashcards, and resourcesβorganized in teaching order.
Identity vs. Projection Shortcuts
Residual Block with Projection Shortcut
Residual Block with Projection Shortcut
Source equation
When the dimensions of the input and the residual output differ (for example, when changing channel depths), a projection shortcut is applied to the input 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}.Deep dive
Let us perform a deterministic calculation to illustrate the projection shortcut.
Assume a 2-dimensional input vector:
Suppose the residual mapping projects the input to a 3-dimensional space:
To perform the addition, we must project the 2-dimensional input to 3 dimensions using the projection matrix :
Compute the projected shortcut:
Finally, add the residual mapping and the projected input:
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 Β· Function
- Set of weight matrices associated with the layers in the block Β· Set of Matrices
- Linear projection matrix used to match dimensions Β· [D_out, D_in]