【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks

    这篇论文有以下4个方面的贡献,在这里我主要是分析前两点贡献,这也是让我感觉最新颖的地方:

  1.   对基于CNN的人脸关键点检测方法中用到的各类损失函数做了系统分析,比较了L1、L2以及smooth L1损失函数,发现L1和smooth L1比L2性能更优;
  2. 提出了一个新的损失函数Wing loss,旨在提高深度网络训练过程中应对小范围和中等范围内的误差的能力;
  3. 提出了基于姿态的(pose-based)的数据增量策略,主要解决训练数据平衡性;
  4. 提出一个二阶段的人脸关键点检测网络;

 

【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks

    图3展示了L1、L2以及Smooth L1损失函数的曲线,其数学表达式分别如下:

【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks

损失函数对x的导数分别为:

【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks

观察 (4),当 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 增大时 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 损失对 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 的导数也增大。这就导致训练初期,预测值与gt差异过于大时,损失函数对预测值的梯度十分大,导致训练不稳定。根据方程 (5),【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 的导数为常数。在训练后期,预测值与 ground truth 差异很小时, 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 损失对预测值的导数的绝对值仍然为1,此时learning rate 如果不变,损失函数将在稳定值附近波动,难以继续收敛以达到更高精度。再看表达 式(6), 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 较小时,对 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 的梯度也会变小,而在 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 很大时,对 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 的梯度的绝对值达到上限 1,也不会太大以至于破坏网络参数。 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 完美地避开了 【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks 损失的缺陷。根据fast rcnn的说法,"...... L1 loss that is less sensitive to outliers than the L2 loss used in R-CNN and SPPnet." 也就是smooth L1 loss让loss对于离群点更加鲁棒,即:相比于L2损失函数,其对离群点、异常值(outlier)不敏感,梯度变化相对更小,训练时不容易跑飞。人脸关键点检测中复杂的地方就在于需要同时优化很多个点(如:68个点)的位置,单纯地使用L1或L2难以达到目标。

    对于人脸关键点检测问题,假如训练图像为【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks,网络为【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks,可以将要预测的人脸关键表示为向量【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks,则损失定义如下:

                                                                    【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks             

s表示人脸关键点向量ground-truth,f(x)就是上面提到的损失函数。作者在AFLW数据集上使用CNN-6网络实验了3种不同的损失函数,其结果如下:

【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks

可以惊喜地发现使用L1或者smooth L1损失函数用于训练,就准确率而言提升很明显。再看看累积错误分布曲线(CED,Cumulative Error Distribution),这个曲线我第一眼硬没看懂,直到看到论文中作者的这句话:We can see that all the loss functions analysed in the last section per- form well for large errors. This indicates that the training of a neural network should pay more attention to the sam- ples with small or medium range errors。这么说吧,当NME在0.04的时候,测试数据比例已经接近1了,所以在0.04到0.05这一段,也就是所谓的large errros段,并没有更多的测试数据加入进来,说明各损失函数在large errors段都表现很好。大家表现不一致的地方就在于small errors和medium errors段,这在图上也很明显。例如,你在NME为0.02的地方画一根竖线,一目了然。所以,作者提出训练过程中应该更多关注samll or medium range errros样本。

【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks

    small errors的影响可以通过引入诸如【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks这样的对数函数来改善。它的梯度为1/x,越接近0梯度值越大。The magnitude of the optimal step size is x^2(什么意思?)。当综合各个关键点的贡献时,梯度主要是被small errors主导,但是step size是被large errors影响。这样就不同尺度的errors影响的平衡。然而,为了防止在错误的方向上步子迈得太大,不要过度受small errors的影响,因此考虑给log函数加上一个偏置。这样对于应付samll localisation errors已经比较合适了,但是对于特殊姿态的情况,初始errors将会很大,这种情况下损失函数应该能够尽快从large errros中恢复,此时就应该考虑L1或L2这类函数了,由于L2对于离群点比较敏感,所以首推L1。基于这些讨论,作者设计出了一个新的损失函数wing loss,其定义如下:

【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks

w是一个非负数,它将非线性部分限制在(-w,w)区间内,【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks用于约束曲线的弯曲程度。C就是一个常量,用于连接损失函数的线性和非线性部分。

【论文解读】Wing Loss for Robust Facial Landmark Localisation with Convolutional Neural Networks

【参考文献】

论文:https://arxiv.org/abs/1711.06753

https://www.zhihu.com/question/58200555

 

上一篇:《DSLR-Quality Photos on Mobile Devices with Deep Convolutional Networks》研读笔记


下一篇:多尺度训练与测试