PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

1. 摘要

ReLUReLU 的基础上作者提出了 PReLUPReLU,在几乎没有增加额外参数的前提下既可以提升模型的拟合能力,又能减小过拟合风险。

针对 ReLU/PReLUReLU/PReLU 的矫正非线性,作者设计了一个鲁棒的的参数初始化方法。

2. 介绍

在过去几年,随着更强大网络模型的构建和有效防止过拟合策略的设计,我们在视觉识别任务上取得了长足的进步。一方面,由于网络复杂性的增加(比如增加深度、扩大宽度)、小步长的使用、新的**函数和更成熟的网络层设计,神经网络变得更加能够拟合训练数据。另一方面,有效的正则化技术、数据增广和大规模的数据让网络获得了更好的泛化能力。

其中,**函数 ReLUReLU 是其中一个非常关键的因素,本文在此基础上做了两点主要改进。首先,我们提出了一个新的**函数 PReLUPReLU (Parametric Rectified Linear Unit),该**函数可以自适应地学习矫正线性单元的参数,并且能够在增加可忽略的额外计算成本下提高准确率。其次,我们研究了模型训练的难度,得出了一种理论上合理的初始化方法,有助于深层网络模型的收敛。

3. PReLU

我们设计的**函数定义如下:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

其中,yiy_i 是非线性**函数 ff 在第 ii 个通道的输入,aia_i 负责控制负半轴的斜率。在这里,我们允许不同通道的**函数不一样。当 ai=0a_i=0 时,PReLUPReLU 就变成了 ReLUReLU,而且 aia_i 是一个可以学习的参数。

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

如果 aia_i 是一个小的固定值,那么 PReLUPReLU 就变成了 LReLULReLU(Leaky ReLU)。LReLULReLU 的动机是为了避免零梯度,实验表明 LReLULReLU 相较 ReLUReLU 对准确率几乎没有提高。但是,作者希望模型能够自适应地学习 PReLUPReLU 的参数,从而能够得到更专门的**函数。

另外,作者也设计了一个通道共享的变体,也就是同一层网络所有通道共享同一个参数,这样,每一层仅仅引入了一个额外的参数。

在反向传播过程中,ai{a_i} 的更新公式可以通过链式法则求出,ε\varepsilon 代表目标函数。

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

然后,采用动量的方法来更新 ai{a_i}

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

作者没有使用权重衰减(L2 正则化),因为这样会让 ai{a_i} 趋向于 0。在实验中,即使没有正则化,学习到的系数幅度也很少会大于 1。而且,对 ai{a_i} 的范围也未做限制,因此**函数也可能是非单调的。

作者设计了一个简单的网络来验证 PReLUPReLU 的有效性,学习到的系数如下表所示。

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

这其中,有两个有意思的现象。一,第一个卷积层的系数远远比 0 要大(0.681, 0.596),因为这一层的卷积核大部分是类 Gabor 过滤器,比如说边缘、纹理检测器,学习到的结果表明卷积核的正负响应都被接受。这在卷积核数量有限的情况下,可以被认为是一个更加经济地利用低层次信息的方式。二,对于通道独立的**函数,较深的卷积层通常具有较小的系数。 这意味着**函数在深度增加时逐渐变得“更加非线性”。 换句话说,学习模型倾向于在较早阶段保留更多信息,并在更深层次阶段变得更具辨别力。

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

针对通道共享的版本,PReLUPReLU 仅仅引入了 13 个额外的参数,却取得了相对于基线情况 1.1% 的提升,这也表明了自适应学习**函数形状的重要性。

4. 卷积核权重的初始化

近来,深层卷积神经网络的权重都是用正态分布来初始化的。若采用固定的标准差,非常深的模型很难收敛。对此,我们可以采取预训练的方式来初始化模型,但这样就需要更长的训练时间。先前的学者也提出了一个 XavierXavier 初始化方法,但它针对的是**函数满足线性的情况, ReLU/PReLUReLU/PReLU 却不满足这个特性。

4.1. 前向传播情况

针对一个卷积层,其前向传播为:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

xx 是一个 k2c1k^2c*1 的向量,代表 cc 个通道 k×kk×k 区域的像素,kk 是卷积核的大小,n=k2cn=k^2c 代表一个**值局部连接的像素个数。WW 是一个 d×nd×n 的矩阵,dd 是卷积核的个数,WW 的每一行代表一个卷积核的权重。我们用 ll 来标识某一层,则有 xl=f(yl1)x_l=f(y_{l-1})ff 是**函数,且有 cl=dl1c_l=d_{l-1}

我们让 WlW_l 初始化的元素互相独立且同分布,然后假设 xlx_l 中的元素也是互相独立并且同分布的,而且 xlx_lWlW_l 互相独立,那么有:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

Var[X1+X2++Xn]=Var[X1]+Var[X2]++Var[Xn]Var[X_1+X_2+\cdots+X_n] = Var[X_1] + Var[X_2] + \cdots +Var[X_n],如果 X1,X2, ,XnX_1,X_2,\cdots,X_n 互相独立,这里每个 wlixliw_l^i*x_l^i 是互相独立的,总共对 nln_l 项求和。

wlw_l 具有零均值,然后有:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

Var[X]=E[X2](E[X])2Var[X]=E[X^2]-(E[X])^2
Var[wl]=E[wl2](E[wl])2=E[wl2]Var[w_l] = E[w_l^2]-(E[w_l])^2=E[w_l^2]
E[wl]E[xl]=0E[xl]=0E[w_l]E[x_l] = 0*E[x_l]=0
Var[wlxl]=E[(wlxl)2](E[wlxl])2=E[wl2]E[xl2](E[wl]E[xl])2=Var[wl]E[xl2]Var[w_lx_l]=E[(w_lx_l)^2]-(E[w_lx_l])^2=E[w_l^2]E[x_l^2]-(E[w_l]E[x_l])^2=Var[w_l]E[x_l^2]

这里,E[xl2]̸=Var[xl]E[x_l^2] \not = Var[x_l],因为 ReLUReLU **函数关于原点不对称,xlx_l 均值不为 0。

如果让 wl1w_{l-1} 关于原点对称分布并且 bl1=0b_{l-1}=0,那么 yl1y_{l-1} 也具有对称分布并且均值为 0。那么有:

Var[yl1]=E[yl12](E[yl1])2=E[yl12]Var[y_{l-1}] =E[y_{l-1}^2]-(E[y_{l-1}])^2=E[y_{l-1}^2]

经过 ReLUReLU **函数后,一半的 yl1y_{l-1} 变成了 0,所以有:

E[xl2]=12E[yl12]=12Var[yl1]E[x_l^2]=\frac{1}{2}E[y_{l-1}^2]=\frac{1}{2}Var[y_{l-1}]

代入前面的式子,可得:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

LL 层网络放在一起,则有:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

这个乘积是初始化参数的关键。一个合适的初始化方式应该避免指数级减少或者放大输入信号的幅度,因此我们期望上面的乘积有一个合理的尺度,比如 1。

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

这就是一个零均值标准差为 2/nl\sqrt{2/n_l} 的正态分布,也就是作者提出的参数初始化方式,同时,初始化偏置 b=0b=0

针对第一层网络,对输入我们没有应用**函数,因此应该有 n1Var[w1]=1n_1Var[w_1]=1,但这只有一层,为了简化,所有层的参数我们都按照上面的式子来初始化。

4.2. 反向传播情况

同理,一个卷积层的反向传播可以表示为:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

这里,为了简化,Δx\Delta xΔy\Delta y 就代表相应变量的梯度。

Δy\Delta y 代表 dd 个通道 k×kk×k 区域的像素,被调整为了一个 k2d1k^2d*1 的向量。n^=k2d̸=n\hat n=k^2d\not =nW^\hat W 是一个 c×n^c×\hat n 的矩阵,Δx\Delta x 是一个 c1c*1 的向量,代表这一层每个像素的梯度值。

假设 wlw_lΔyl\Delta y_l 互相独立,wlw_l 关于原点对称且具有零均值,那么 Δxl\Delta x_l 也具有零均值。同时,我们有:

Δyl=f(yl)Δxl+1\Delta y_l=f'(y_l)\Delta x_{l+1}

如果**函数是 ReLUReLU,那么 f(yl)f'(y_l) 要么为 0 要么为 1,而且概率相等,因此有:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

因子 12\frac{1}{2} 的出现都是因为**函数是 ReLUReLU,把 LL 层网络放在一起,则有:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

如果梯度不会指数级增大或者缩小的话,需要有:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

这是一个零均值标准差为 2/n^l\sqrt{2/\hat n_l} 的正态分布,和前面唯一不同的是 n^l=kl2dl\hat n_l=k_l^2d_lnl=kl2cl=kl2dl1n_l=k_l^2c_l=k_l^2d_{l-1}。针对第一层网络,对输入我们不需要求梯度,但同理为了简化,所有层的参数我们都采用一样的方式来初始化。

通过前向传播得到的式子和通过反向传播得到的式子都是可行的,因为二者只是相差了一个因子。也就是说如果初始化能够适当地缩放后向信号,那么前向信号也是如此; 反之亦然。对于作者实验的所有模型,两种形式都可以使它们收敛。

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

针对 PReLUPReLU,我们则很容易得到:

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

5. 实验

5.1 和 XavierXavier 初始化方法的对比

针对一个 22 层的模型,用本文提出的初始化方式比 XavierXavier 能更快收敛。

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

针对一个 30 层的模型,用本文提出的初始化方式可以使模型收敛,但用 XavierXavier 则无法收敛。

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

5.2 ReLUReLUPReLUPReLU 的对比

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

5.3 和其他模型的对比

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification

获取更多精彩,请关注「seniusen」!

PReLU——Delving Deep into Rectifiers: Surpassing Human-Level Performance on ImageNet Classification