Basic Theory
Deep Residual Learning

Deep Residual Learning

In order to solve the accuracy degradation problem, the authors introduced a deep residual learning framework.

Residual Learning

To start with, we would hypothesize that multiple nonlinear layers can asymptotically approximate complicated functions, then it is equivalent to hypothesize that they can asymptotically approximate the residual functions.

Let us consider H(x)\mathcal{H}(x) as an underlying mapping to be fit by a few stacked layers, with xx denoting the inputs to the first of these layers, then the residual equations can be defined as:

F(x):=H(x)x\mathcal{F}(x) := \mathcal{H}(x) - x

assuming that the input and output are of the same dimensions. The original function thus becomes:

H(x)=F(x)+x\mathcal{H}(x) = \mathcal{F}(x) + x

This rephrasing is inspired by the surprising aspects of the accuracy degradation issue. If additional layers are designed as identity mappings, a deeper model should not have a higher training error than a shallower one. However, the degradation issue implies that solvers may struggle to replicate identity mappings using multiple nonlinear layers. With the introduction of residual learning, if identity mappings are ideal, solvers could potentially steer the weights of these nonlinear layers towards zero, thereby closely approximating identity mappings.

Identity Mapping by Shortcuts

The authors introduced a shortcut connection that skips one or more layers. The shortcut connections are used to perform identity mapping, and the residual block is defined as:

y=F(x,{Wi})+xy = \mathcal{F}(x, \{W_i\}) + x

Here xx and yy are the input and output vectors of the layers considered. The function F(x,{Wi})\mathcal{F}(x, \{W_i\}) represents the residual mapping to be learned. A picture of the residual block is shown below:

residual-block

In this shown example, the block has two layers. F=W2σ(W1x)\mathcal{F} = W_2\sigma(W_1x) in which σ\sigma denotes the ReLU activation function. The operation F+x\mathcal{F} + x is performed by a shortcut connection and element-wise addition.

Note that, this shortcut will not add any extra parameter nor computational complexity. In this case, the dimensions of xx and F\mathcal{F} must be equal for the addition operation to be performed.

However, when the dimensions of xx and F\mathcal{F} are not equal, the authors introduced a projection shortcut to match the dimensions. The projection shortcut is defined as:

y=F(x,{Wi})+Wsxy = \mathcal{F}(x, \{W_i\}) + W_sx

where WsW_s is a projection matrix.