Print

发布时间: 2018-04-16
摘要点击次数:
全文下载次数:
DOI: 10.11834/jig.170336
2018 | Volume 23 | Number 4




    图像理解和计算机视觉    




  <<上一篇 




  下一篇>> 





融合判别式深度特征学习的图像识别算法
expand article info 黄旭, 凌志刚, 李绣心
湖南大学电气与信息工程学院, 长沙 410082

摘要

目的 卷积神经网络在图像识别算法中得到了广泛应用。针对传统卷积神经网络学习到的特征缺少更有效的鉴别能力而导致图像识别性能不佳等问题,提出一种融合线性判别式思想的损失函数LDloss(linear discriminant loss)并用于图像识别中的深度特征提取,以提高特征的鉴别能力,进而改善图像识别性能。方法 首先利用卷积神经网络搭建特征提取所需的深度网络,然后在考虑样本分类误差最小化的基础上,对于图像多分类问题,引入LDA(linear discriminant analysis)思想构建新的损失函数参与卷积神经网络的训练,来最小化类内特征距离和最大化类间特征距离,以提高特征的鉴别能力,从而进一步提高图像识别性能,分析表明,本文算法可以获得更有助于样本分类的特征。其中,学习过程中采用均值分批迭代更新的策略实现样本均值平稳更新。结果 该算法在MNIST数据集和CK+数据库上分别取得了99.53%和94.73%的平均识别率,与现有算法相比较有一定的提升。同时,与传统的损失函数Softmax loss和Hinge loss对比,采用LDloss的深度网络在MNIST数据集上分别提升了0.2%和0.3%,在CK+数据库上分别提升了9.21%和24.28%。结论 本文提出一种新的融合判别式深度特征学习算法,该算法能有效地提高深度网络的可鉴别能力,从而提高图像识别精度,并且在测试阶段,与Softmax loss相比也不需要额外的计算量。

关键词

卷积神经网络; 深度特征学习; LDA(linear discriminant analysis); 损失函数; LDloss

Discriminative deep feature learning method by fusing linear discriminant analysis for image recognition
expand article info Huang Xu, Ling Zhigang, Li Xiuxin
College of Electrical and Information Engineering, Hunan University, Changsha 410082, China
Supported by: National Natural Science Foundation of China(61471166)

Abstract

Objective Feature extraction plays an important role in image recognition, including face recognition and character recognition. However, feature extraction usually depends on domain knowledge or prior experiences. Convolutional neural networks (CNNs) are attracting the attention of researchers because they can automatically extract efficient features and simultaneously achieve image recognition via their self-learning capability. However, the learned features via classical CNNs may often have a poor discriminant capability for image recognition. This study introduces a linear discriminant analysis loss (LDloss) into CNNs and develops a discriminative deep feature learning method by fusing linear discriminant analysis (LDA) for image recognition. Therefore, CNNs can provide discriminant features to improve image recognition performance. Method A deep CNN for feature extraction is constructed to automatically extract efficient features for image classification tasks via a multilayer perceptron. LDA is introduced, and a new linear discriminant loss function (LDloss) is developed via a variant form of Fisher criterion. The new LDloss and softmax loss are integrated into a united loss function for deep feature learning. The learned features can minimize classification error and simultaneously achieve inter-class dispension and intra-class compactness. An average strategy based on mini-batch is used to update class centers in the learning process. Result Experimental results on MNIST and CK+ databases show that the proposed algorithm achieves 99.53% and 94.73% average recognition rates, respectively. Unlike softmax and hinge losses, LDloss achieves 0.2% and 0.3% increases on the MNIST database and 9.21% and 24.28% increases on the CK+ database under the same network structure, respectively. The proposed method can achieve 100% recognition rate for some classification in the MNIST and CK+ databases. Conclusion This study proposes a new discriminant deep feature learning algorithm for image recognition. The experimental results on different databases show that this proposed method can explicitly achieve intra-class compactness and inter-class separability among learned features and further efficiently improve the discriminative capability of the learned features. Therefore, the proposed method can achieve a higher accuracy recognition rate than some existing methods can. The proposed method also does not need additional computation load compared with softmax loss during the testing stage.

Key words

convolutional neural networks; deep feature learning; LDA (linear discriminant analysis); loss function; LDloss

0 引言

图像特征提取与表征是图像识别中的关键步骤之一,其性能好坏极大的影响到最终的识别结果。为此, 研究学者投入了大量的精力来设计简洁高效的特征表征算子如尺度不变特征变换(SIFT) [1]、方向梯度直方图(HOG) [2]等用于图像识别。然而,这些特征表征算子仍依赖人的先验知识,存在着设计困难、效率低等缺点。近年来,基于深度学习网络的特征自动提取方法以其优异的性能受到越来越多研究学者的关注,并在图像[3-4]、语音[5]、视频[6]等各个领域得到广泛应用。如LeCun等人[3, 7]提出的卷积神经网络(CNN)通过局部连接和权值共享,大大降低了网络复杂性,并在手写体数据集MNIST识别等方面得到大量应用。Chan等人[8]在CNN的基础上提出了一种基于主成分分析(PCA)的深度学习网络PCANet,以使得图像分类的网络训练更加简化;Girshick等人[9]将CNN应用于目标检测中,从而引发了深度学习在目标检测领域的热潮;Ling等人[10]将CNN用于解决图像去雾中大气传输图的估计问题。

CNN训练中常采用损失函数来评价当前模型的预测值与真实值的契合程度,并用于更新网络参数。常用的损失函数有误差平方和损失函数(square loss)、与SVM相关的铰链损失函数(hinge loss)[11]、Softmax loss和contrastive loss[12]等等。一般认为,损失函数越小,模型参数估计性能越优。然而,如Softmax loss一样,大多数损失函数都只是利用标签值,并未考虑到样本特征的类间间距和类内间距之间的关系,从而难以确保样本类间有效地分离和类内充分地聚合。文献[13]结合Softmax loss与contrastive loss来增强样本类内的紧凑性和类间的可分性[14-15];文献[16]则一次选取3个样本即Anchor样本、正样本和负样本,利用triplet loss来最小化Anchor样本与正样本的距离同时最大化其与负样本的距离来训练网络。但contrastive loss和triplet loss的方法在面对大量数据时,对所需样本的选取是其中的难点和关键设计之一[14-15],当特定的样本选取不当时,亦会影响最终识别效果。而文献[15]在Softmax loss的基础上,考虑各类别与中心的距离,引入center loss用于人脸识别中并取得了较好的识别结果,但其并未深入考量各类中心与整体样本中心的距离度量。

为此,针对图像分类任务提出了一种融入判别式信息的损失函数LDloss用于训练深度网络。首先,引入卷积神经网络进行训练图像的深度特征提取,然后,提出融入判别式信息的损失函数LDloss对所得图像特征来统一考虑样本类间距离和类内距离,并采用分批迭代更新的策略来实现均值更新,最终使得训练后网络能直接利用原始训练样本信息并能够最大化样本的类间距离,同时最小化样本的类内距离,从而提升深度网络的分类效果。实验验证,本文所提的LDloss优于现有的损失函数,能有效地提高深度网络的可鉴别能力,而且本文方法在测试阶段,与Softmax loss相比也不需要额外的计算量,具有较强的适应性。

1 相关工作

1.1 线性判别式分析算法

线性判别式分析(LDA)是最经典的模式识别特征提取算法之一,并在各个领域应用广泛。其核心思想在于将高维空间样本特征通过线性映射转化为低维空间样本特征,并使得样本在低维空间中类间距离足够大而类内距离尽可能小[17]

假设${\mathit{\boldsymbol{R}}^d}$空间的$m$个样本表示为$\mathit{\boldsymbol{x}}_{1}, \mathit{\boldsymbol{x}}_{2}, ...,\mathit{\boldsymbol{x}}_{m}$,其中,$\mathit{\boldsymbol{x}}_{i}$$d$维向量。若样本共$k$类,并设$n_{i}$是对应第$i$类的样本数,则$n_{1}+n_{2}+...+n_{k}=m$。样本的类间离散度矩阵$\mathit{\boldsymbol{S}}_{\rm b}$与类内离散度矩阵$\mathit{\boldsymbol{S}}_{\rm w}$可分别表示为

$ {\mathit{\boldsymbol{S}}_{\rm{b}}} = \sum\limits_{i = 1}^k {{n_i}\left( {{\mathit{\boldsymbol{u}}_i}-\mathit{\boldsymbol{u}}} \right)} {\left( {{\mathit{\boldsymbol{u}}_i}-\mathit{\boldsymbol{u}}} \right)^{\rm{T}}} $ (1)

$ {\mathit{\boldsymbol{S}}_{\rm{w}}} = \sum\limits_{i = 1}^k {\sum\limits_{{x_j} \in clas{s_i}} {\left( {{\mathit{\boldsymbol{u}}_i}-{\mathit{\boldsymbol{x}}_j}} \right){{\left( {{\mathit{\boldsymbol{u}}_i}-{\mathit{\boldsymbol{x}}_j}} \right)}^{\rm{T}}}} } $ (2)

式中,$\mathit{\boldsymbol{u}}$是所有样本均值,$\mathit{\boldsymbol{u}}_{i}$为第$i$类样本的均值,即有:$ {\mathit{\boldsymbol{u}}_i} = \frac{1}{{{n_i}}}\sum\limits_{{x_j} \in clas{s_i}} \mathit{\boldsymbol{x}} $$\mathit{\boldsymbol{u = }}\frac{1}{m}\sum\limits_{i = 1}^m {{\mathit{\boldsymbol{x}}_i}} $。则鉴别准则${\rm Fisher}$准则函数定义为

$ {J_{{\rm{fisher}}}}\left( j \right) = \frac{{{\mathit{\boldsymbol{\varphi }}^{\rm{T}}}{\mathit{\boldsymbol{S}}_{\rm{b}}}\mathit{\boldsymbol{\varphi }}}}{{{\mathit{\boldsymbol{\varphi }}^{\rm{T}}}{\mathit{\boldsymbol{S}}_{\rm{w}}}\mathit{\boldsymbol{\varphi }}}} $ (3)

式中,$\mathit{\boldsymbol{\varphi }}$表示原空间映射到低维空间的投影方向。${\rm Fisher}$准则函数旨在求解能使$J_{{\rm fisher}}(j)$达到最大值的$\mathit{\boldsymbol{\varphi }}$使样本投影在低维空间中类间距离$\mathit{\boldsymbol{S}}_{\rm b}$尽可能大,而类内距离$\mathit{\boldsymbol{S}}_{\rm w}$尽可能小,从而达到理想的分类效果。

然而,直接优化式(3)计算复杂,${\rm Fisher}$准则函数常转化为最大化${\rm tr}(\mathit{\boldsymbol{S}}_{\rm b})/{\rm tr}(\mathit{\boldsymbol{S}}_{\rm w})$或最小化变形式${\rm tr}(\mathit{\boldsymbol{S}}_{\rm w})-β×{\rm tr}(\mathit{\boldsymbol{S}}_{\rm b})$来求解$\mathit{\boldsymbol{\varphi }}$,其中${\rm tr}(·)$是矩阵的迹,$β$是正则参数,来平衡类间和类内散度[18-20]

1.2 Softmax loss函数

Softmax loss函数是CNN中常用的损失函数,其本质上是逻辑回归(logistic regression)模型在多分类任务上的一种延伸,具体定义为

$ {J_s} =- \frac{1}{m}\left[{\sum\limits_{i = 1}^m {\sum\limits_{j = 1}^k {l\left\{ {{\mathit{\boldsymbol{x}}_i} \in {c_j}} \right\}\log \frac{{{{\rm{e}}^{\mathit{\boldsymbol{w}}_j^{\rm{T}}{\mathit{\boldsymbol{x}}_i}}}}}{{\sum\limits_{l = 1}^k {{{\rm{e}}^{\mathit{\boldsymbol{w}}_l^{\rm{T}}{\mathit{\boldsymbol{x}}_i}}}} }}} } } \right] $ (4)

式中,$\mathit{\boldsymbol{w}}_{j}∈\bf{R}^{\mathit{\boldsymbol{d}}}$为权重$\mathit{\boldsymbol{w}}∈\bf{R}^{\mathit{\boldsymbol{d}}×\mathit{\boldsymbol{k}}}$$j$列的矢量,$l\{·\}$为示性函数,即$l${表达式为真}=1,否则为0, $\mathit{\boldsymbol{x}}_{i}∈c_{j}$表示样本$\mathit{\boldsymbol{x}}_{i}$的标签属于第$j$类。在多分类任务中,Softmax loss采用交叉熵的形式,计算方便,结果形式简单,可直接将分类结果以最大概率形式输出,通过梯度下降能快速地进行参数优化,实现分类目标,故而在CNN中得到广泛应用。

2 基于判别式的深度学习算法

2.1 LDloss定义

假设属于第$c_{j}$类的样本$i$经CNN的全连接处理后输出特征向量为$\mathit{\boldsymbol{x}}_{i}$,则其与类$c_{j}$中心$\mathit{\boldsymbol{u}}_{j}$的距离$\mathit{\boldsymbol{d}}_{\bf{w}}(i, j)$以及类$c_{j}$均值与整体样本均值的间距$\mathit{\boldsymbol{d}}_{\bf{b}}(j)$可以表示为

$ {\mathit{\boldsymbol{d}}_{\rm{w}}} = \left( {i, j} \right) = {\left( {{\mathit{\boldsymbol{x}}_i}-{\mathit{\boldsymbol{u}}_j}} \right)^{\rm{T}}}\left( {{\mathit{\boldsymbol{x}}_i}-{\mathit{\boldsymbol{u}}_j}} \right) $ (5)

$ {\mathit{\boldsymbol{d}}_{\rm{b}}}\left( j \right) = {\left( {{\mathit{\boldsymbol{u}}_j}-u} \right)^{\rm{T}}}\left( {{\mathit{\boldsymbol{u}}_j}-u} \right) $ (6)

为减小卷积神经网络的运算复杂度,借鉴${\rm Fisher}$准则函数${\rm tr}(\mathit{\boldsymbol{S}}_{\rm w})-β×{\rm tr}(\mathit{\boldsymbol{S}}_{\rm b})$的形式,定义基于特征维度的判别式公式为

$ \mathit{\boldsymbol{D}}\left( {i, j} \right) = {\mathit{\boldsymbol{d}}_{\rm{w}}}\left( {i, j} \right)-\mathit{\boldsymbol{\beta }}{\mathit{\boldsymbol{d}}_{\rm{b}}}\left( j \right) $ (7)

显然,若$\mathit{\boldsymbol{x}}_{\mathit{\boldsymbol{i}}}∈c_{j}$类,当样本$\mathit{\boldsymbol{x}}_{\mathit{\boldsymbol{i}}}$与第$j$类样本均值的距离$\mathit{\boldsymbol{d}}_{\rm w}$越小,且第$j$类样本均值与整体样本均值距离$\mathit{\boldsymbol{d}}_{\rm b}$越大时,样本$\mathit{\boldsymbol{x}}_{\mathit{\boldsymbol{i}}}$的区分性越好,越容易被正确分类,此时$\mathit{\boldsymbol{d}}_{\rm w}(i, j)$$\mathit{\boldsymbol{d}}_{\rm b}(j)$的差值$\mathit{\boldsymbol{D}}(i, j)$越小。在示性函数$l\{\mathit{\boldsymbol{x}}_{i}∈c_{j}\}$的作用下,定义基于判别式距离度量的代价函数$J_{L}$定义为

$ {J_L} =-\frac{1}{m}\sum\limits_{i = 1}^m {\sum\limits_{j = 1}^k {l\left\{ {{\mathit{\boldsymbol{x}}_i} \in {c_j}} \right\}\log \frac{{{{\rm{e}}^{-\mathit{\boldsymbol{D}}\left( {i, j} \right)}}}}{{\sum\limits_{l = 1}^k {{{\rm{e}}^{-\mathit{\boldsymbol{D}}\left( {i, l} \right)}}} }}} } $ (8)

式中,归一化分值$\mathit{\boldsymbol{s}}\left( {i, j} \right) = {{\rm{e}}^{-\mathit{\boldsymbol{D}}\left( {i, j} \right)}}/\sum\limits_{l = 1}^k {{{\rm{e}}^{-\mathit{\boldsymbol{D}}\left( {i, l} \right)}}} $用于消除$\mathit{\boldsymbol{D}}(i, j)$不同范围值的影响。显然,如样本$\mathit{\boldsymbol{x}}_{\mathit{\boldsymbol{i}}}$距离正确类别$j$越近,且距离其他类别越远,则$\mathit{\boldsymbol{s}}(i, j)$越大。当所有样本均具有此特性,则代价函数$J_{\rm L}$具有最小值。因此,通过最小化代价函数$J_{\rm L}$可使得样本的类内距离$\mathit{\boldsymbol{d}}_{\bf{w}}$最小以及各样本类均值与整体样本中心距离$\mathit{\boldsymbol{d}}_{\bf b}$最大,从而实现样本特征类内紧凑而类间区分度好,进而保证提取的特征具有良好的鉴别能力,实现样本的最大可分性。

此外,为了确保深度卷积网络提取的特征向量能够正确分类,将Softmax loss代价函数$J_{s}$与基于判别式距离度量的代价函数$J_{\rm L}$进行加权组合,定义最终的线性判别式损失函数(LDloss)为

$ {J_{{\rm{LD}}}} = {J_s} + \alpha \times {J_{\rm{L}}} $ (9)

式中,$α$是用于调整两个代价函数的比重系数。可以看出,当利用$J_{{\rm LD}}$作为深度网络训练的代价函数时,不仅保证网络学习到的特征可以最小化分类误差,而且具有较强的可区分性,从而使得损失函数$J_{{\rm LD}}$能在较少的训练次数下达到更好的分类效果。反之,若只采用Softmax loss作为损失函数,则训练深度网络提取的特征缺少有效的判别能力;若只采用基于判别式距离度量的代价函数$J_{\rm L}$作为损失函数,则在网络的迭代更新过程中,网络提取的特征分类精度还有待提升。因此,选用将$J_{s}$$J_{\rm L}$组合的形式$J_{{\rm LD}}$作为最终的损失函数。

提出的LDloss函数借助参数$β$和参数$α$实现了对同类聚合和异类离散的明确控制,在数据样本选取上也较contrastive loss和triplet loss更加的方便,并且LDloss可以很方便地替代其他损失函数,也可与其他性能提升方法或模块组合使用,如激活函数优化、数据扩增功能或修改网络结构等。

2.2 权重更新

为训练更新CNN网络,采用梯度下降法计算损失函数对$\mathit{\boldsymbol{x}}_{\mathit{\boldsymbol{i}}}$的偏导进行CNN的反向传播来更新网络,网络的反向传播误差计算公式为

$ \frac{{\partial J_{{\rm{LD}}}^t}}{{\partial x_i^t}} = \frac{{\partial J_s^t}}{{\partial x_i^t}} + \alpha \cdot \frac{{\partial J_{\rm{L}}^t}}{{\partial x_i^t}} $ (10)

式中,$t$为网络第$t$次迭代。其中,$\partial J_s^t/\partial x_i^t$即Softmax loss代价函数$J_{s}$采用传统方法进行反向更新的形式,$J_{\rm L}$$\mathit{\boldsymbol{x}}_{\mathit{\boldsymbol{i}}}$的偏导计算公式$\partial J_{\rm{L}}^t/\partial x_i^t$以及网络的权值$W$更新公式为

$ \begin{array}{l} \;\;\;\;\;\;\;\;\;\;\;\;\;\nabla {J_{\rm{L}}} = \frac{{\partial {J_{\rm{L}}}}}{{\partial {x_i}}} =- \frac{1}{m}\sum\limits_{i = 1}^m {\sum\limits_{j = 1}^k {l\left\{ {{\mathit{\boldsymbol{x}}_i} \in {c_j}} \right\}} } \cdot \\ \left[{- 2\left( {{\mathit{\boldsymbol{x}}_i}- {\mathit{\boldsymbol{u}}_j}} \right)- \frac{{\sum\limits_{l = 1}^k {{{\rm{e}}^{ - \left[{{{\left( {{\mathit{\boldsymbol{x}}_i}-{\mathit{\boldsymbol{u}}_l}} \right)}^{\rm{T}}}\left( {{\mathit{\boldsymbol{x}}_i}-{\mathit{\boldsymbol{u}}_l}} \right)-\beta {{\left( {{\mathit{\boldsymbol{u}}_l} - \mathit{\boldsymbol{u}}} \right)}^{\rm{T}}}\left( {{\mathit{\boldsymbol{u}}_l} - \mathit{\boldsymbol{u}}} \right)} \right]}}\left[{-2\left( {{\mathit{\boldsymbol{x}}_i}-{\mathit{\boldsymbol{u}}_l}} \right)} \right]} }}{{\sum\limits_{l = 1}^k {{{\rm{e}}^{ - \left[{{{\left( {{\mathit{\boldsymbol{x}}_i}-{\mathit{\boldsymbol{u}}_l}} \right)}^{\rm{T}}}\left( {{\mathit{\boldsymbol{x}}_i}-{\mathit{\boldsymbol{u}}_l}} \right)-\beta {{\left( {{\mathit{\boldsymbol{u}}_l} - \mathit{\boldsymbol{u}}} \right)}^{\rm{T}}}\left( {{\mathit{\boldsymbol{u}}_l} - \mathit{\boldsymbol{u}}} \right)} \right]}}} }}} \right] \end{array} $ (11)

$ {W^{t + 1}} = {W^t}-{\eta ^t}\frac{{\partial J_s^t}}{{\partial {W^t}}} $ (12)

式中, $η$为网络学习率。

2.3 均值更新策略

式(5)(6)中需要计算各类样本及全体样本经深度网络处理后的特征均值,在网络训练过程中随着深度网络参数变换,这些输出特征的均值会随之发生改变;而且当使用大样本数据进行训练时,直接对所有训练样本进行统计和计算均值的操作难以实现准确估计。为此,采用分批迭代更新的策略来实现计算。1)针对训练集均值的更新,利用基于mini-batch块的训练数据来更新各类的均值以及整体均值。2)为了避免不同batch块间个别数据存在噪声而对均值造成较大的扰动,通过设置小于1的正参数$λ$来控制均值更新速度,使得均值更新更加平稳,总样本及各类均值更新公式为

$ {\mathit{\boldsymbol{u}}^{t + 1}} = \lambda {\mathit{\boldsymbol{u}}^t} + \left( {1-\lambda } \right)\Delta {\mathit{\boldsymbol{u}}^{t + 1}} $ (13)

$ \mathit{\boldsymbol{u}}_j^{t + 1} = \lambda \mathit{\boldsymbol{u}}_j^t + \left( {1-\lambda } \right)\Delta \mathit{\boldsymbol{u}}_j^{t + 1} $ (14)

式中,$Δ\mathit{\boldsymbol{u}}^{t+1}$是第$t+1$次迭代过程中单个batch里所有样本的总均值,$Δ\mathit{\boldsymbol{u}}^{t+1}_{j}$是第$t+1$次迭代过程中单个batch里的第$j$类样本的均值。则在第$t+1$次迭代过程中,最终的样本总均值$\mathit{\boldsymbol{u}}^{t+1}$是对第$t$次迭代的总均值$\mathit{\boldsymbol{u}}^{t}$和第$t+1$次迭代中单个batch的样本总均值$Δ\mathit{\boldsymbol{u}}^{t+1}$的结合;第$j$类样本的均值$\mathit{\boldsymbol{u}}^{t+1}_{j}$是对第$t$次迭代的第$j$类样本均值$\mathit{\boldsymbol{u}}^{t}_{j}$和第$t+1$次迭代中单个batch的第$j$类样本均值$Δ\mathit{\boldsymbol{u}}^{t+1}_{j}$的结合。

3 实验结果及分析

为了验证本文算法的性能,分别在公开数据集MNIST数据库[7]和Extended Cohn-Kanade(CK+)人脸表情数据库[21]上进行实验验证。深度网络基于Matconvnet[22]工具箱实现,硬件平台采用配置至强E5八核处理器3.60 GHz和16 GB内存的工作站。

3.1 基于MNIST数据集验证

MNIST手写体数据集包含7万幅有10类(0-9)灰度图像,经过标准归一化处理后,大小皆为28×28像素。实验中采用6万幅作为训练样本,1万幅作为测试样本。实验深度网络采用改进的LeNet-5网络模型[7],具体网络结构如图 1所示。其中,(5, 5, 1, 15)表示卷积层的卷积核大小为5×5,滤波器数为15个,stride为1,采样层采用最大池化层,FC表示全连接层。

图 1 MNIST手写体数据集的网络结构图
Fig. 1 The network structure of MNIST handwritten database

图 2给出了基于图 1网络分别采用Softmax loss和LDloss训练网络时正确识别率随迭代次数的对比曲线图,可以看出,与Softmax loss相比,LDloss具有更高的识别准确率,表明了引入的判断式策略是有效的。为了进一步验证LDloss的可区分性能,我们在LeNet-5网络模型[7]的基础上,将倒数第2层全连接输出维度设置为2,设置成LeNet-view网络用于特征可视化,具体网络结构如表 1所示,池化层(2, 2)/2表示采用最大池化,利用2×2的滤波器,padding和stride分别设置为0和2。在测试集上的特征散点图可视化如图 3所示。

图 2 不同迭代次数下LDloss和Softmax loss对比
Fig. 2 Comparison of LDloss and Softmax loss

表 1 经典CNN网络及相应特征可视化表
Table 1 Classic CNN network and corresponding feature visualization table

下载CSV
Layer Conv Pool Conv Pool FC
LeNet-5 (5, 5, 1, 20) (2, 2)/2 (5, 5, 20, 50) (2, 2)/2 (4, 4, 50, 500)
LeNet-view (5, 5, 1, 20) (2, 2)/2 (5, 5, 20, 50) (2, 2)/2 (4, 4, 50, 2)
图 3 测试集特征可视化
Fig. 3 Test set feature visualization
((a) Softmax loss network test set visualization; (b) LDloss network test set visualization)

图 3(a)可以看出,尽管利用Softmax loss函数,CNN通过特征学习能达到数据分类的效果,但深度网络提取的特征之间缺乏良好的区分性能,相反,采用LDloss后,CNN不仅能实现数据分类,而且确保提取到的特征具有良好的可区分性,从而进一步提高准确识别率,使分类效果更优。为了防止过拟合以及加快训练速度,在图 1的网络结构上,引入了BN(batch normalization)层重新训练网络进行分类识别,其识别结果的混淆矩阵如图 4所示。可以看出,本文方法在MNIST数据集上有较好的效果。

图 4 MNIST数据集上的混淆矩阵
Fig. 4 Confusion matrix on MNIST dataset

3.2 关于参数$α$和参数$β$的讨论

式(9)中参数$α$主要用于调节$J_{s}$$J_{\rm L}$的比重,当$α=0$,损失函数仅为Softmax loss;式(7)中参数$β$是用来平衡类间和类内散度。显然,不同的$α$值和$β$值对系统性能有不同影响。为了探讨参数$α$和参数$β$对实验效果的影响,基于3.1节实验,通过分别选取不同的$α$值和$β$值进行如图 5图 6所示的对比实验。实验结果表明,随着$α$值增大,整体准确率呈现先增后减的趋势,并在$α=1.5$处达到最大值,即表明当$J_{s}$$J_{\rm L}$的比重为1 :1.5时,实验准确率最高;同理,在$β=1.0$时,实验准确率最高。

图 5 基于MNIST数据集对参数$α$的实验对比结果
Fig. 5 Comparison experimental results of parameter $α$ based on MNIST dataset
图 6 基于MNIST数据集对参数$β$的实验对比结果
Fig. 6 Comparison experimental results of parameter $β$ based on MNIST dataset

此外,将本文方法与现有新方法以及不同损失函数进行对比实验,实验结果如表 2所示,本文LDloss方法($α=1.5,β=1.0$)在简单网络结构下与NiN方法具有最高的准确率。在基于不同损失函数的对比实验中可以看出,对比传统的损失函数Softmax loss和Hinge loss,利用LDloss在MNIST数据集上平均识别率分别提升了0.2%和0.3%,验证了本文方法有效地提高了样本特征可鉴别能力,从而图像分类效果有显著的提升。

表 2 MNIST数据集在不同方法下的对比实验
Table 2 Comparison experiment of MNIST dataset under different methods

下载CSV
方法 准确率/%
CNN[23] 99.47
DropConnect[24] 99.43
Fitnet[25] 99.49
PCANet[8] 99.38
NiN[26] 99.53
Contrastive loss 98.46
Hinge loss(L2) 99.23
Softmax loss 99.33
Center loss 99.41
Center loss(LeNets++) 99.47
本文 99.53

3.3 基于CK+人脸表情数据集验证

Extended Cohn-Kanade(CK+)数据库扩展于Cohn-Kanade (CK)数据库,记录了1850岁之间210个成年人的表情图像。共593个图像序列,其中327个图像序列带表情标签。由于CK+数据库是一种渐变表情的数据库,仅使用表情特征较明显的图片,并经过预处理将纯表情样本图片归一化为100×100像素大小,如图 7所示。由于通过筛选后的样本数量偏少,将所选样本左右翻转进行样本扩充,同时为了防止出现识别同一人脸的偶然误差,需保证训练集与样本集分属不同的人,从而共获取5 872幅训练样本和532幅测试样本,网络模型结构图如图 8所示。

图 7 Extended Cohn-Kanade数据库的纯表情图示例
Fig. 7 Examples of a pure expression for the Extended Cohn-Kanade database
图 8 CK+数据集的网络结构图
Fig. 8 The Network Structure of CK+ Dataset

在CK+测试集上识别结果的混淆矩阵表如表 3所示。本文方法在某些类别如Fear、Happy等上已经取得100%的识别率。而其中Disgust表情的识别率偏低很大原因是误分类为Anger表情,由于Disgust和Anger有较高的相似性,尤其是包括嘴唇的闭合度、皱眉程度、眼睛张开程度以及整体脸型的轮廓等都有较高的相似性,且在训练样本中,Anger样本比Disgust更多,可获得更多的隐含规律特征, 从而导致本文方法在类别Disgust上具有较低的分类准确率。

表 3 CK+测试集上的混淆矩阵表
Table 3 The confusion matrix on the CK + test set

下载CSV
Anger Disgust Fear Happy Sadness Surprise 准确率/%
Anger 116 0 4 0 0 0 96.67
Disgust 16 62 4 0 0 0 75.61
Fear 0 0 32 0 0 0 100
Happy 0 0 0 110 0 0 100
Sadness 0 0 0 0 64 0 100
Surprise 0 0 4 0 0 120 96.77

表 4进一步给出了与现有新方法以及在不同损失函数下的对比实验结果,本文方法在CK+数据库上的识别率达到了94.73%,识别率较高。与表 2类似,采用如图 8所示网络结构,对比传统的损失函数Softmax loss和Hinge loss,利用LDloss在CK+数据库上平均识别率分别提升了9.21%和24.28%。实验表明,本文方法在CK+数据库上取得了较好的效果,正确识别率明显优于其他方法,进一步验证了算法的有效性。

表 4 不同方法下的CK+数据库实验对比结果
Table 4 The results of the CK+ database test under different methods

下载CSV
方法 准确率/%
AdaGabor[27] 93.3
CSPL+SVM[28] 89.89
FP+SAE[29] 91.11
AUDN[30] 93.70
Softmax loss 85.52
Hinge loss 70.45
Center loss 81.8
本文 94.73

从式(9)可以看出,本文方法是将Softmax loss代价函数$J_{s}$和基于判别式距离度量的代价函数$J_{L}$组合的形式LDloss$J_{{\rm LD}}$作为最终的损失函数。因此,本文方法在训练时间上相比Softmax los网络要慢上一些。但对于实验测试部分,本文方法只用到Softmax loss分支,因此在同一数据集上的测试时间基本相差不大。

4 结论

提出了一种融合的线性判别式损失函数(LDloss)并应用于CNN图像识别中。该损失函数借助LDA思想来训练深度网络,以便提取的深度特征具有最小类内距离与最大类间距离,并结合Softmax loss的分类效果,使得CNN提取的特征不仅能够最优化分类误差,而且具有很好的鉴别能力。在不同数据集上的实验结果表明本文提出的LDloss能进一步提升图像分类性能。下一步工作将进一步优化LDloss算法并将其应用于不同领域。

参考文献

  • [1] Lowe D G. Distincitive image features from scale-invariant keypoints[J]. International Journal of Computer Vision, 2004, 60(2): 91–110. [DOI:10.1023/B:VISI.0000029664.99615.94]
  • [2] Dalal N, Triggs B. Histograms of oriented gradients for human detection[C]//Proceedings of 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition. San Diego, CA, USA: IEEE, 2005: 886-893. [DOI:10.1109/CVPR.2005.177]
  • [3] LeCun Y, Boser B, Denker J S, et al. Backpropagation applied to handwritten zip code recognition[J]. Neural Computation, 1989, 1(4): 541–551. [DOI:10.1162/neco.1989.1.4.541]
  • [4] Li Y Y, Xu Y L, Ma S P, et al. Saliency detection based on deep convolutional neural network[J]. Journal of Image and Graphics, 2016, 21(1): 53–59. [李岳云, 许悦雷, 马时平, 等. 深度卷积神经网络的显著性检测[J]. 中国图象图形学报, 2016, 21(1): 53–59. ] [DOI:10.11834/jig.20160107]
  • [5] Amodei D, Ananthanarayanan S, Anubhai R, et al. Deep speech 2: end-to-end speech recognition in English and mandarin[C]//Proceedings of the 33rd International Conference on Machine Learning. New York, NY, USA: ICML, 2016: 173-182. http://www.oalib.com/paper/4015889
  • [6] Karpathy A, Toderici G, Shetty S, et al. Large-scale video classification with convolutional neural networks[C]//Proceedings of 2014 IEEE Conference on Computer Vision and Pattern Recognition. Columbus, OH, USA: IEEE, 2014: 1725-1732. [DOI:10.1109/CVPR.2014.223]
  • [7] Lecun Y, Bottou L, Bengio Y, et al. Gradient-based learning applied to document recognition[J]. Proceedings of the IEEE, 1998, 86(11): 2278–2324. [DOI:10.1109/5.726791]
  • [8] Chan T H, Jia K, Gao S H, et al. PCANet:a simple deep learning baseline for image classification?[J]. IEEE Transactions on Image Processing, 2015, 24(12): 5017–5032. [DOI:10.1109/TIP.2015.2475625]
  • [9] Girshick R, Donahue J, Darrell T, et al. Rich feature hierarchies for accurate object detection and semantic segmentation[C]//Proceedings of 2014 IEEE Conference on Computer Vision and Pattern Recognition. Columbus, OH, USA: IEEE, 2014: 580-587. [DOI:10.1109/CVPR.2014.81]
  • [10] Ling Z G, Fan G L, Wang Y N, et al. Learning deep transmission network for single image dehazing[C]//Proceedings of 2016 IEEE International Conference on Image Processing. Phoenix, AZ, USA: IEEE, 2016: 2296-2300. [DOI:10.1109/ICIP.2016.7532768]
  • [11] Wahba G. Support vector machines, reproducing kernel Hilbert spaces, and randomized GACV[C]//Advances in Kernel Methods. Cambridge, MA, USA: MIT Press, 1999: 69-88. http://dl.acm.org/citation.cfm?id=299099
  • [12] Hadsell R, Chopra S, LeCun Y. Dimensionality Reduction by Learning an Invariant Mapping[C]//Proceedings of 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition. New York, USA: IEEE, 2006: 1735-1742. [DOI:10.1109/CVPR.2006.100]
  • [13] Sun Y, Chen Y H, Wang X G, et al. Deep learning face representation by joint identification-verification[C]//Proceedings of 2014 Advances in Neural Information Processing Systems. [S. l. ]: NIPS, 2014: 1988-1996. http://www.oalib.com/paper/4082134
  • [14] Liu W Y, Wen Y D, Yu Z D, et al. Large-margin softmax loss for convolutional neural networks[C]//Proceedings of the 33rd International Conference on Machine Learning. New York, NY, USA: ICML, 2016: 507-516. http://www.researchgate.net/publication/311492579_Large-Margin_Softmax_Loss_for_Convolutional_Neural_Networks?ev=prf_high
  • [15] Wen Y D, Zhang K P, Li Z F, et al. A discriminative feature learning approach for deep face recognition[C]//Proceedings of the 14th European Conference on Computer Vision. Amsterdam, The Netherlands: Springer, 2016: 499-515. [DOI:10.1007/978-3-319-46478-7_31]
  • [16] Schroff F, Kalenichenko D, Philbin J. FaceNet: a unified embedding for face recognition and clustering[C]//Proceedings of 2015 IEEE Conference on Computer Vision and Pattern Recognition. Boston, MA, USA: IEEE, 2015: 815-823. [DOI:10.1109/CVPR.2015.7298682]
  • [17] Huang P, Tang Z M. Minimum-distance discriminant projection and its application to face recognition[J]. Journal of Image and Graphics, 2013, 18(2): 201–206. [黄璞, 唐振民. 最小距离鉴别投影及其在人脸识别中的应用[J]. 中国图象图形学报, 2013, 18(2): 201–206. ] [DOI:10.11834/jig.20130211]
  • [18] Guo Y F, Li S J, Yang J Y, et al. A generalized Foley-Sammon transform based on generalized Fisher discriminant criterion and its application to face recognition[J]. Pattern Recognition Letters, 2003, 24(1-3): 147–158. [DOI:10.1016/S0167-8655(02)00207-6]
  • [19] Yang M, Zhang L, Feng X C, et al. Sparse representation based fisher discrimination dictionary learning for image classification[J]. International Journal of Computer Vision, 2014, 109(3): 209–232. [DOI:10.1007/s11263-014-0722-8]
  • [20] Wang H, Yan S C, Xu D, et al. Trace ratio vs. ratio trace for dimensionality reduction[C]//Proceedings of 2007 IEEE Conference on Computer Vision and Pattern Recognition. Minneapolis, MN, USA: IEEE, 2007: 1-8. [DOI:10.1109/CVPR.2007.382983]
  • [21] Lucey P, Cohn J F, Kanade T, et al. The extended Cohn-Kanade dataset (CK+): a complete dataset for action unit and emotion-specified expression[C]//Proceedings of 2010 Computer Society Conference on Computer Vision and Pattern Recognition Workshops. San Francisco, CA, USA: IEEE, 2010: 94-101. [DOI:10.1109/CVPRW.2010.5543262]
  • [22] Vedaldi A, Lenc K. MatConvNet: convolutional neural networks for MATLAB[C]//Proceedings of the 23rd ACM International Conference on Multimedia. Brisbane, Australia: ACM, 2015: 689-692. [DOI:10.1145/2733373.2807412]
  • [23] Jarrett K, Kavukcuoglu K, Ranzato M, et al. What is the best multi-stage architecture for object recognition?[C]//Proceedings of the IEEE 12th International Conference on Computer Vision. Kyoto, Japan: IEEE, 2009: 2146-2153. [DOI:10.1109/ICCV.2009.5459469]
  • [24] Wan L, Zeiler M, Zhang S X, et al. Regularization of neural networks using dropconnect[C]//Proceedings of the 30th International Conference on Machine Learning. Atlanta, USA: ICML, 2013: 1058-1066. http://www.researchgate.net/publication/291735245_Regularization_of_neural_networks_using_dropconnect
  • [25] Romero A, Ballas N, Ebrahimi Kahou S, et al. Fitnets: hints for thin deep nets[J]. arXiv preprint arXiv: 1412. 6550, 2014. http://www.oalib.com/paper/4068134
  • [26] Lin M, Chen Q, Yan S C. Network in network[J]. arXiv preprint arXiv: 1312. 4400, 2013.
  • [27] Bartlett M S, Littlewort G, Frank M, et al. Recognizing facial expression: machine learning and application to spontaneous behavior[C]//Proceedings of 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition. San Diego, CA, USA: IEEE, 2005: 568-573. [DOI:10.1109/CVPR.2005.297]
  • [28] Zhong L, Liu Q S, Yang P, et al. Learning active facial patches for expression analysis[C]//Proceedings of 2012 IEEE Conference on Computer Vision and Pattern Recognition. Providence, RI, USA: IEEE, 2012: 2562-2569. [DOI:10.1109/CVPR.2012.6247974]
  • [29] Lv Y D, Feng Z Y, Xu C. Facial expression recognition via deep learning[C]//Proceedings of 2014 International Conference on Smart Computing. Hong Kong, China: IEEE, 2014: 303-308. [DOI:10.1109/SMARTCOMP.2014.7043872]
  • [30] Liu M Y, Li S X, Shan S G, et al. AU-inspired deep networks for facial expression feature learning[J]. Neurocomputing, 2015, 159: 126–136. [DOI:10.1016/j.neucom.2015.02.011]