Print

发布时间: 2017-06-16
摘要点击次数:
全文下载次数:
DOI: 10.11834/jig.160583
2017 | Volume 22 | Number 6




    图像处理和编码    




  <<上一篇 




  下一篇>> 





非负局部Laplacian稀疏编码和上下文信息的图像分类
expand article info 万源, 史莹, 陈晓丽
武汉理工大学理学院, 武汉 430070

摘要

目的 稀疏编码是图像特征表示的有效方法,但不足之处是编码不稳定,即相似的特征可能会被编码成不同的码字。且在现有的图像分类方法中,图像特征表示和图像分类是相互独立的过程,提取的图像特征并没有有效保留图像特征之间的语义联系。针对这两个问题,提出非负局部Laplacian稀疏编码和上下文信息的图像分类算法。 方法 图像特征表示包含两个阶段,第一阶段利用非负局部的Laplacian稀疏编码方法对局部特征进行编码,并通过最大值融合得到原始的图像表示,从而有效改善编码的不稳定性;第二阶段在所有图像特征表示中随机选择部分图像生成基于上下文信息的联合空间,并通过分类器将图像映射到这些空间中,将映射后的特征表示作为最终的图像表示,使得图像特征之间的上下文信息更多地被保留。 结果 在4个公共的图像数据集Corel-10、Scene-15、Caltech-101以及Caltech-256上进行仿真实验,并和目前与稀疏编码相关的算法进行实验对比,分类准确率提高了约3%~18%。 结论 本文提出的非负局部Laplacian稀疏编码和上下文信息的图像分类算法,改善了编码的不稳定性并保留了特征之间的相互依赖性。实验结果表明,该算法与现有算法相比的分类效果更好。另外,该方法也适用于图像分割、标注以及检索等计算机视觉领域的应用。

关键词

稀疏编码; 非负局部Laplacian稀疏编码; 最大值融合; 图像表示; 上下文信息; 联合空间

Image classification with non-negative and local Laplacian sparse coding and context information
expand article info Wan Yuan, Shi Ying, Chen Xiaoli
School of Science, Wuhan University of Technology, Wuhan 430070, China
Supported by: National Natural Science Foundation of China(91324201, 81271513)

Abstract

Objective Image classification is an important issue in computer vision and a hot research topic. The traditional sparse coding (SC) method is effective for image representation and has achieved good results in image classification. However, the SC method has two drawbacks. First, the method ignores the local relationship between image features, thus losing local information. Second, because the combinatorial optimization problems of SC involve addition and subtraction, the subtraction operation might cause features to be cancelled. These two drawbacks result in coding instability, which means similar features are encoded into different codes. Meanwhile, representation and classification are usually independent of each other during image classification, so the features of image semantic relations between image features are not well preserved. In other words, image representation is not task-driven and may be unable to perform the final classification task well. Furthermore, the local feature quantization method disregards the underlying semantic information of the local region, which influences the classification performance. To deal with such problems, a two-stage method of image classification with non-negative and local Laplacian SC and context information (NLLSC-CI) is proposed in this study. NLLSC-CI aims to improve the efficiency of image representation and the accuracy of image classification. Method The representation of an image involves two stages. In the first stage, non-negative and locality-constrained Laplacian SC (NLLSC) is introduced to the encoding of the local features of the image to overcome coding instability. First, non-negativity is introduced in Laplacian SC (LSC) by non-negative matrix factorization (NMF) to avoid offsetting between features, which is applied to constrain the negativity of the codebook and code coefficient. Second, bases that are near the local features are selected to constrain the codes because locality is more important than sparseness; thus, the local information between features is preserved. Then, original image representation is attained by using spatial pyramid division (SPD) and max pooling (MP) in the pooling step. In the second stage, several original image representations are selected and connected to generate joint context spaces. All images are then mapped into these spaces by the SVM classifier. The mapped features in these joint context spaces are regarded as the final representations of images. In this manner, image representation and classification tasks are considered jointly to achieve improved performance. This two-stage representation method preserves the context relationship between the features of images to a certain extent. Results To validate the performance of the proposed method, experiments on four public image datasets, namely, Corel-10, Scene-15, Caltech-101, and Calthch-256, are conducted.Results suggest that the classification accuracy of NLLSC-CI increases by about 3% to 18% compared with that of state-of-the-art SC algorithms. The accuracy rate of NLLSC-CI increases by 3% to 12% in the Corel-10 dataset. For the Scene-15 dataset, classification accuracy increases by 4% to 15%. The classification performance in the Caltech-101 and Caltech-256 datasets increases by 3% to 14% and 4% to 18%, respectively. These findings show that the classification accuracy of the proposed method is better than that of state-of-art SC algorithms in the four benchmark image datasets. In addition, Tables 2 to 5 show that classification accuracy is the lowest in the Calthch-256 dataset. The reason could be the size of this dataset. The dataset contains too many categories and images, and the difference between and within classes is too large. As a result, the corresponding category of images cannot be identified correctly during classification. Thus, the accuracy of the proposed method is relatively low for datasets with large numbers and multiple classes of images. In general, however, NLLSC-CI demonstrates improved classification accuracy. Conclusion This study proposes an algorithm called NLLSC-CI to solve coding instability and the independence between image representation and classification. The proposed method overcomes coding instability and preserves the mutual context dependency between the local features of images. Specifically, due to the incorporation of non-negativity, locality, and graph Laplacian regularization, this new method improves the consistency of sparse codes and their mutual dependency, thus preserving more features and local information between them and making the local features more discriminating. The new optimization problem in NLLSC-CI is solved by defining a diagonal matrix to obtain the analytical solution. Furthermore, the consistency of sparse codes is maintained by introducing a Laplacian matrix. This two-stage method of image representation jointly considers two independent tasks:image representation and classification. The construction of a joint space based on context information preserves the context between image features, and the image representation obtained by context information and image classification are mutually dependent. Therefore, NLLSC-CI can model images adequately and represent the original images through mutual dependency and context information among features, thus improving the classification accuracy. Several benchmark image datasets are studied, and the final experimental results show that the proposed algorithm presents better performance than other previous algorithms. In addition, this novel method can be applied to other computer vision issues, such as image segmentation, image annotation, and image retrieval. Meanwhile, extensive image data need to be maximized because the experimental image data used in this study are from several standard image datasets. Moreover, although the context information of this method can effectively convey the information expressed by images, it cannot reflect the complete method of thinking of humans. Therefore, other methods and models of image semantic content that are closer to humans' perception and thinking need to be investigated.

Key words

sparse coding (SC); non-negativity and locality constrained Laplacian sparse coding (NLLSC); max pooling (MP); image representation; context information; joint spaces

0 引言

图像分类[1]是计算机视觉领域中一个重要的研究问题,其关键在于提取合适的特征表示图像。目前应用得最广泛的是利用局部特征,如局部不变特征转换(SIFT)[2]特征来表示图像[3-4]。为了提高量化的准确率,稀疏编码(SC)方法[5]被应用在图像分类中。然而,SC对特征的变化很敏感,Gao等人[6]引入Laplacian稀疏编码(LSC)方法来改善编码的不稳定性。针对SC优化问题中减法的运算可能会使特征之间相互抵消,Lee等人[7]引入非负性。Han等人[8]提出基于非负性和依赖性约束的SC方法,利用非负矩阵因式分解(NMF)和Laplacian算子,使特征和特征之间的相似性都得以保留。考虑到特征之间的局部信息,局部性[9]被应用到SC模型中。刘培娜等人[10]考虑到局部约束线性编码(LLC)中编码的某些正值和负值元素的差值绝对值随$K$近邻编码中$K$值的增大而增大,引入非负性约束,提出非负LLC图像分类算法;Min等人[11]在LLC中加入Laplacian正则化,提出基于Laplacian正则化的LLC图像分类算法。

以上这些编码方法中,图像特征表示和分类过程是相对独立的,而图像视觉特征和人类理解的语义概念之间可能会造成语义鸿沟。为了解决这个问题,刘硕研等人[12]引入语义的概念。图像特征的上下文信息作为重要的语义信息,反映图像中对象之间的相互关系,将其与视觉特征结合已成为语义图像理解和分析的潜在趋势[13-14]。为了使图像的上下文信息和视觉信息更多地被保留,应用最多的是通过判别模型[15-16]从训练图像中构建语义空间,将上下文信息的语义特征成功地运用在语义模型中。

针对上述编码方法的研究,第1个不足之处是相似的特征会被编码成不同的码字,从而造成编码的不稳定性。第2个缺点是编码中的图像特征表示和分类是两个独立的过程,局部特征量化方法忽略了局部区域的潜在上下文语义信息,从而影响图像分类的效果。为了克服第1个缺点,本文在LSC模型[6]中加入非负性和局部性,构造NLLSC方法,保留特征及其之间的局部信息和空间几何信息,极大改善编码的不稳定性。针对第2个缺点,本文在NLLSC的基础上引入图像的上下文信息,反映图像中语义对象之间的关系和对象所处的周围环境,综合考虑了图像表示和分类,提出NLLSC-CI算法,从而提高图像的分类效率。

1 相关工作

图像分类中最经典的编码方法就是词袋(BoW)模型[3],将其与SIFT特征结合,能较好地表征图像的特性。考虑到图像局部特征之间的空间信息,空间金字塔匹配(SPM)模型[4]被应用在图像分类中。但BoW和SPM模型中的量化方法很容易造成量化误差,Yang等人[5]结合SPM模型,提出ScSPM的图像分类算法,其核心问题是学习$M$空间中的超完备($M \gg D$)字典$\mathit{\boldsymbol{U}}$,并选取其中尽可能少的基向量来表示原始的特征向量,得到的优化问题

$\left\{ {\begin{array}{*{20}{l}} {\mathop {{\rm{min}}}\limits_{\mathit{\boldsymbol{U}},\mathit{\boldsymbol{V}}} \sum\limits_{i = 1}^N {\left( {\left\| {{\mathit{\boldsymbol{x}}_i} - \mathit{\boldsymbol{U}}{\mathit{\boldsymbol{v}}_i}} \right\|_2^2 + \mathit{\boldsymbol{\lambda }}{{\left\| {{\mathit{\boldsymbol{v}}_i}} \right\|}_1}} \right)} }\\ {{\rm{s}}{\rm{.t}}{\rm{.}}\left\| {{\mathit{\boldsymbol{u}}_j}} \right\|_2^2 \le 1,\forall j = 1,2, \cdots ,\mathit{\boldsymbol{M}}} \end{array}} \right.$ (1)

式中,$\mathit{\boldsymbol{X}} \in {{\bf{R}}^{D \times N}}$为特征矩阵,$\mathit{\boldsymbol{U}} \in {{\bf{R}}^{D \times M}}$为字典,$\mathit{\boldsymbol{V}} \in {{\bf{R}}^{M \times N}}$为相应的稀疏编码。而传统的SC在编码过程中极其不稳定,相似的局部特征可能会被编码成不同的码字,Gao等人[6]引入Laplacian矩阵来保持相似局部特征的编码的一致性,改善编码的不稳定性并使编码过程不再独立。相应的优化问题为

$\left\{ {\begin{array}{*{20}{l}} {\mathop {{\rm{min}}}\limits_{\mathit{\boldsymbol{U}},\mathit{\boldsymbol{V}}} \left\| {\mathit{\boldsymbol{X}} - \mathit{\boldsymbol{UV}}} \right\|_{\rm{F}}^2 + \mathit{\boldsymbol{\lambda }}\sum\limits_i {{{\left\| {{\mathit{\boldsymbol{v}}_i}} \right\|}_1}} + \beta {\rm{tr}}\left( {\mathit{\boldsymbol{VL}}{\mathit{\boldsymbol{V}}^{\rm{T}}}} \right)}\\ {{\rm{s}}{\rm{.t}}{\rm{.}}\left\| {{\mathit{\boldsymbol{u}}_j}} \right\|_2^2 \le 1,\forall j = 1,2, \cdots ,\mathit{\boldsymbol{M}}} \end{array}} \right.$ (2)

式中,目标函数中的第3项${\beta {\rm{tr}}\left( {\mathit{\boldsymbol{VL}}{\mathit{\boldsymbol{V}}^{\rm{T}}}} \right)}$用来提取图像的空间几何信息,减少量化误差;$\mathit{\boldsymbol{L}}$为Laplacian矩阵。然而,SC和LSC的优化问题中都涉及加法和减法的交互运算,减法的使用有可能会使特征之间相互抵消。因此,Lee等人[7]通过NMF来学习物体的部分表示,并提出一种解决NMF问题的算法。Han等人[8]利用NMF和Laplacian算子,提出基于非负性和依赖性约束的SC方法,使特征和特征之间的相似性都得以保留。然而,这些方法都忽视了特征之间的局部性信息。因此,Wang等人[9]引入局部性提出LLC的图像分类方法。虽然LLC的亮点在于其利用了$K$近邻编码,但是随着$K$值的增大,编码的某些正值元素和负值元素的差值绝对值会随之增大,因此刘培娜等人[10]在LLC中引入非负性约束,提出非负LLC图像分类方法。考虑到在SC的过程中,相似的特征有可能会被编码成不同的码字,Min等人[11]提出Laplacian正则化的LLC图像分类算法,保持相似特征的编码一致性。

对于以上这些编码方法,图像表示和分类过程是相对独立的,且图像底层特征和高层语义特征之间具有不统一,可能造成语义鸿沟。为了克服这个缺点,刘硕研等人[12]提出图像表示的语义概念并在图像分类中得到应用[13-14]。李昌英[13]针对图像语义分类中存在的问题,提出一种上下文信息的语义图像分类方法,根据条件随机场、能量模型和基于属性关系图的模型有效地利用了图像的语义信息和空间关系信息,提高图像分类的准确率。生海迪等人[14]在SPM中加入邻域范围内局部特征之间的语义分布信息,构造语义短语,生成语义词典,并对图像进行直方图表示,从而改善图像的表示效率。对于构建图像的语义空间,最有效的方法是直接使用判别模型[15-16]。为了增加语义信息,Zhang等人[15]提出子语义空间,并利用其进行图像分类。但是当图像的类内变化很大时,仅仅生成一个语义空间可能不会更好地模拟图像的类别,因此,Zhang等人[16]在此基础上,结合SC方法,提出随机语义空间中的联合图像表示和分类算法。

2 NLLSC和上下文信息的图像分类

以上这些编码方法都能在一定程度上减少重构误差,但是它们存在两个缺点:1) 特征之间缺乏非负性和局部性,从而导致图像表示中特征以及它们之间信息的缺失。2) 图像特征表示与分类器的训练过程是相对独立的,且局部特征量化方法没有考虑到局部区域的潜在上下文语义信息,这会阻碍图像的特征在信息表达和传递中的效率。为了克服第1个缺点,本文在LSC方法中添加非负性和局部性,构建NLLSC方法,有效利用特征之间的局部信息和依赖关系,改善编码的不稳定性并保持相似编码的一致性。对于第2个缺点,在NLLSC的基础上综合考虑图像特征表示和分类两个过程,提出NLLSC-CI的图像分类方法。图像特征表示过程分为两个阶段,第1阶段用NLLSC方法对图像的局部特征进行编码,并利用MP得到原始的图像表示。第2阶段从所有图像表示中随机选择部分图像生成相应的基于上下文信息的联合空间。再利用训练好的分类器将所有训练图像投影到这些空间中。两阶段的图像表示方法能够充分有效地融合图像的视觉特征信息和上下文语义信息,更加恰当完整地表示图像,从而提高图像的分类效率。最后,利用支持向量机(SVM)分类器[17]对图像进行分类。

该方法可以概括成3个部分,其整体框架如图 1所示。

图 1 NLLSC-CI方法的整体框架
Fig. 1 The overall framework of NLLSC-CI method

2.1 基于NLLSC方法的原始图像表示

这节介绍利用NLLSC方法获得原始的图像表示。

2.1.1 学习局部约束的非负字典和编码

由于利用所有局部特征同时构建局部适应器[9]和Laplacian矩阵的计算复杂度很高,因此本文从这些局部特征中随机选择部分特征作为模板特征进行后续的字典和编码学习。首先给出基于模板特征的NLLSC初始公式。在LSC模型中加入非负性和局部性,可得问题

$\left\{ {\begin{array}{*{20}{l}} {\mathop {{\rm{min}}}\limits_{\mathit{\boldsymbol{U}},\mathit{\boldsymbol{V}}} \sum\limits_{i = 1}^N {\left( {\left\| {{\mathit{\boldsymbol{x}}_i} - \mathit{\boldsymbol{U}}{\mathit{\boldsymbol{v}}_i}} \right\|_2^2 + \mathit{\boldsymbol{\lambda }}\left\| {{\mathit{\boldsymbol{d}}_i} \odot {\mathit{\boldsymbol{v}}_i}} \right\|_2^2} \right) + \beta {\rm{tr}}\left( {\mathit{\boldsymbol{VL}}{\mathit{\boldsymbol{V}}^{\rm{T}}}} \right)} }\\ {{\rm{s}}{\rm{.t}}{\rm{.}}\left\| {{\mathit{\boldsymbol{u}}_j}} \right\|_2^2 \le 1,\mathit{\boldsymbol{U}} \ge 0,\mathit{\boldsymbol{V}} \ge 0,\forall j} \end{array}} \right.$ (3)

式中,$\mathit{\boldsymbol{X}} = \left[ {{\mathit{\boldsymbol{x}}_1},{\mathit{\boldsymbol{x}}_2}, \cdots ,{\mathit{\boldsymbol{x}}_N}} \right] \in {{\bf{R}}^{D \times N}}$为非负的特征矩阵,$\mathit{\boldsymbol{U}}$$\mathit{\boldsymbol{V}}$为相应的非负字典和非负编码;$\lambda ,\beta $都为给定的常数;⊙代表两个列向量逐元素相乘;${\mathit{\boldsymbol{d}}_i} \in {{\bf{R}}^M}$是一个局部适应器,定义为

$\begin{array}{*{20}{c}} {{\mathit{\boldsymbol{d}}_i} = {\rm{exp}}\left( {dist\left( {{\mathit{\boldsymbol{x}}_i},\mathit{\boldsymbol{U}}} \right)/\sigma } \right)}\\ {dist\left( {{\mathit{\boldsymbol{x}}_i},\mathit{\boldsymbol{U}}} \right) = }\\ {{{\left[ {dist\left( {{\mathit{\boldsymbol{x}}_i},{\mathit{\boldsymbol{u}}_1}} \right), \cdots ,dist\left( {{\mathit{\boldsymbol{x}}_i},{\mathit{\boldsymbol{u}}_M}} \right)} \right]}^{\rm{T}}}} \end{array}$ (4)

式中,$dist\left( {{\mathit{\boldsymbol{x}}_i},{\mathit{\boldsymbol{b}}_j}} \right)$${{\mathit{\boldsymbol{x}}_i}}$${{\mathit{\boldsymbol{b}}_j}}$之间的欧氏距离,$\sigma $是一个用来调整权重衰减的参数。

对于式(3),采用交替固定$\mathit{\boldsymbol{U}}$(或$\mathit{\boldsymbol{V}}$)来优化$\mathit{\boldsymbol{V}}$(或$\mathit{\boldsymbol{U}}$)的方法来求解。首先固定$\mathit{\boldsymbol{X}}$$\mathit{\boldsymbol{U}}$,可得优化问题

$\left\{ {\begin{array}{*{20}{l}} {\mathop {\min }\limits_\mathit{\boldsymbol{V}} \left\| {\mathit{\boldsymbol{X}} - \mathit{\boldsymbol{UV}}} \right\|_{\rm{F}}^2 + \lambda \left\| {\mathit{\boldsymbol{d}} \odot \mathit{\boldsymbol{V}}} \right\|_{\rm{F}}^2 + \beta {\rm{tr}}\left( {\mathit{\boldsymbol{VL}}{\mathit{\boldsymbol{V}}^{\rm{T}}}} \right)}\\ {{\rm{s}}{\rm{.t}}{\rm{. }}\mathit{\boldsymbol{V}} \ge 0} \end{array}} \right.$ (5)

式中,$\mathit{\boldsymbol{d}} = \left[ {{\mathit{\boldsymbol{d}}_1},{\mathit{\boldsymbol{d}}_2}, \cdots ,{\mathit{\boldsymbol{d}}_N}} \right] \in {{\bf{R}}^{M \times N}}$

为了求解式(5),首先将其转化为矩阵迹的形式,然后再利用Lagrange乘数法(LMM)和KKT条件可得$\mathit{\boldsymbol{V}}$的更新规则为

$\begin{array}{*{20}{c}} {{\mathit{\boldsymbol{v}}_{ij}} = {\mathit{\boldsymbol{v}}_{ij}}\frac{{{{\left( {{\mathit{\boldsymbol{U}}^{\rm{T}}}\mathit{\boldsymbol{X}} + \beta \mathit{\boldsymbol{VW}}} \right)}_{ij}}}}{{{{\left( {{\mathit{\boldsymbol{U}}^{\rm{T}}}\mathit{\boldsymbol{UV}} + \beta \mathit{\boldsymbol{VD}} + \lambda {\rm{diag}}\left( {{\mathit{\boldsymbol{b}}_i}} \right)\mathit{\boldsymbol{V}}} \right)}_{ij}}}}}\\ {\forall i = 1,2, \cdots ,M,j = 1,2, \cdots ,N} \end{array}$ (6)

式中,${\mathit{\boldsymbol{b}}_i} = \left[ {d_{i1}^2,d_{i2}^2, \cdots ,d_{iN}^2} \right]$$N$维行向量,且$d_{ij}^2 = \exp \left( {2{\rm{dist}}\left( {{\mathit{\boldsymbol{x}}_j},{\mathit{\boldsymbol{u}}_i}} \right)/\sigma } \right)$

再固定$\mathit{\boldsymbol{X}}$$\mathit{\boldsymbol{V}}$来优化$\mathit{\boldsymbol{U}}$,相应的优化问题为

$\left\{ {\begin{array}{*{20}{l}} {\mathop {\min }\limits_\mathit{\boldsymbol{U}} \left\| {\mathit{\boldsymbol{X}} - \mathit{\boldsymbol{UV}}} \right\|_{\rm{F}}^2}\\ {{\rm{s}}{\rm{.t}}{\rm{.}}\;\mathit{\boldsymbol{U}} \ge 0,\left\| {{\mathit{\boldsymbol{u}}_j}} \right\|_2^2 \le 1,\forall j = 1,2, \cdots ,M} \end{array}} \right.$ (7)

将式(7) 转化为Lagrange对偶问题,并利用共轭梯度法求对偶矩阵$\mathit{\boldsymbol{ \boldsymbol{\varLambda} }}$,再利用式(8) 求出字典$\mathit{\boldsymbol{U}}$,即

$\mathit{\boldsymbol{U}} = \left( {\mathit{\boldsymbol{X}}{\mathit{\boldsymbol{V}}^{\rm{T}}}} \right){\left( {\mathit{\boldsymbol{V}}{\mathit{\boldsymbol{V}}^{\rm{T}}}\mathit{\boldsymbol{ + \boldsymbol{\varLambda} }}} \right)^{ - 1}}$ (8)

2.1.2 基于新特征的NLLSC

在2.1.1节随机选取一些局部特征$\mathit{\boldsymbol{X}}$(模板特征)来训练$\mathit{\boldsymbol{U}}$$\mathit{\boldsymbol{V}}$。当一个新特征$\mathit{\boldsymbol{Y}}$出现时,利用上述训练好的字典$\mathit{\boldsymbol{U}}$和模板特征的稀疏编码$\mathit{\boldsymbol{V}}$,学习新特征的非负性和局部性约束的LSC。则优化问题为

$\left\{ {\begin{array}{*{20}{l}} {\mathop {\min }\limits_\mathit{\boldsymbol{S}} \left\| {\mathit{\boldsymbol{Y}} - \mathit{\boldsymbol{US}}} \right\|_{\rm{F}}^2 + \lambda \left\| {\mathit{\boldsymbol{d}} \odot \mathit{\boldsymbol{S}}} \right\|_{\rm{F}}^2 + \frac{\beta }{2}\sum\limits_{ji} {\left\| {{\mathit{\boldsymbol{s}}_j} - {\mathit{\boldsymbol{v}}_i}} \right\|_{\rm{2}}^2{w_{ji}}} }\\ {{\rm{s}}{\rm{.t}}{\rm{.}}\quad {s_{ij}} \ge 0,\forall i,j} \end{array}} \right.$ (9)

式中,$\mathit{\boldsymbol{U}}$$\mathit{\boldsymbol{V}}$分别是训练好的字典和编码,${{\mathit{\boldsymbol{v}}_i}}$$\mathit{\boldsymbol{V}}$的第$i$个列向量,$\mathit{\boldsymbol{S}}$是新特征$\mathit{\boldsymbol{Y}}$的稀疏编码。这里的相似矩阵$\mathit{\boldsymbol{W}}$中的元素${{w_{ji}}}$是通过计算新特征与模板特征之间的$K$近邻关系而得出的,其中$K$近邻关系用直方图相交[18]来度量,若模板特征${{\mathit{\boldsymbol{x}}_i}}$与新特征${{\mathit{\boldsymbol{y}}_j}}$$K$近邻关系,${{w_{ji}}}$=1;否则,${{w_{ji}}}$=0。

利用LMM和KKT条件可得$\mathit{\boldsymbol{S}}$的更新规则为

${s_{ij}} = {s_{ij}}\frac{{{{\left( {{\mathit{\boldsymbol{U}}^{\rm{T}}}\mathit{\boldsymbol{Y}} + \beta \mathit{\boldsymbol{V}}{\mathit{\boldsymbol{W}}^{\rm{T}}}} \right)}_{ij}}}}{{{{\left( {{\mathit{\boldsymbol{U}}^T}\mathit{\boldsymbol{US + }}\frac{1}{2}\beta \mathit{\boldsymbol{SA}} + \lambda {\rm{diag}}\left( {{\mathit{\boldsymbol{b}}_i}} \right)\mathit{\boldsymbol{S}}} \right)}_{ij}}}}$ (10)

式中,$\mathit{\boldsymbol{A}}$为对角权重矩阵,且其对角线元素为${a_{jj}} = \sum\limits_i {{w_{ji}}} $

由2.1.1节的相关介绍,可得出字典和模板特征的稀疏编码,再利用式(10) 可得基于新特征的NLLSC。

2.1.3 利用空间金字塔划分进行MP

在特征融合阶段,本文依照文献[5-6, 8, 16],采用最大值融合方法。具体为

$\begin{array}{*{20}{c}} {{r_l} = \max \left\{ {\left| {{s_{1l}}} \right|,\left| {{s_{2l}}} \right|, \cdots ,\left| {{s_{Nl}}} \right|} \right\}}\\ {l = 1,2, \cdots ,M} \end{array}$ (11)

式中,${{s_{Nl}}}$是稀疏编码${{\mathit{\boldsymbol{s}}_N}}$的第$l$个元素;而${{r_l}}$是向量$\mathit{\boldsymbol{r}}$的第$l$个元素。单个空间金字塔区域的图像可以用$M$维列向量$\mathit{\boldsymbol{r}}$来表示,即$\mathit{\boldsymbol{r}} = {\left[ {{r_1},{r_2}, \cdots ,{r_M}} \right]^{\rm{T}}}$

得到一个区域的图像表示之后,再利用空间金字塔划分可获得整个区域的图像表示。

2.2 基于上下文信息的联合图像表示和分类

NLLSC方法中图像特征表示与分类是两个相对独立的过程,且图像的底层视觉特征和高层语义特征之间可能会造成语义鸿沟,这会忽略图像局部区域的上下文语义信息从而影响图像分类效率。因此,为了获得图像特征之间的上下文联系且更有效地表示图像,实现真正意义上的图像语义相似性分类。综合考虑这两个过程,本文提出基于上下文信息的联合图像表示和分类。首先,通过NLLSC方法得到原始的图像表示之后,再利用其构建基于上下文信息的联合空间从而得到图像的最终特征表示;最后,将得到的图像特征在这些联合空间中进行分类。

2.2.1 构建基于上下文信息的联合空间

利用2.1节中的NLLSC方法得到原始的图像表示之后,构造基于上下文信息的联合空间。基于上下文信息的联合空间被定义为将所有图像表示通过分类器训练后得到的整体联合空间,目的是为了表示图像。而每一个联合空间的是利用随机选择的图像通过训练分类器而生成的。

假设通过NLLSC方法获得$Q$个训练图像的原始图像表示,用${\mathit{\boldsymbol{r}}^1},{\mathit{\boldsymbol{r}}^2}, \cdots ,{\mathit{\boldsymbol{r}}^Q}$表示,共$C$类,其相应的类别标签为${\mathit{\boldsymbol{y}}^1},{\mathit{\boldsymbol{y}}^2}, \cdots ,{\mathit{\boldsymbol{y}}^Q}$。从中随机选择$L\left( {L \le Q} \right)$个图像构建基于上下文信息的联合空间,并且重复选择$T$次。相应的结果用

$\left\{ {\left( {{\mathit{\boldsymbol{r}}^{1,1}},{\mathit{\boldsymbol{y}}^{1,1}}} \right), \cdots ,\left( {{\mathit{\boldsymbol{r}}^{L,1}},{\mathit{\boldsymbol{y}}^{L,1}}} \right)} \right\}, \cdots ,\left\{ {\left( {{\mathit{\boldsymbol{r}}^{1,T}},{\mathit{\boldsymbol{y}}^{1,T}}} \right), \cdots ,\left( {{\mathit{\boldsymbol{r}}^{L,T}},{\mathit{\boldsymbol{y}}^{L,T}}} \right)} \right\}$表示。对于第$t$次随机选择的图像$\left\{ {\left( {{\mathit{\boldsymbol{r}}^{1,t}},{\mathit{\boldsymbol{y}}^{1,t}}} \right), \cdots ,\left( {{\mathit{\boldsymbol{r}}^{L,t}},{\mathit{\boldsymbol{y}}^{L,t}}} \right)} \right\}$,利用SVM分类器来构建相应的联合空间,即

$\begin{array}{l} \mathit{\boldsymbol{f}}_c^t\left( {{\mathit{\boldsymbol{r}}^{l,t}}} \right) = \mathit{\boldsymbol{\bar y}}_c^{l,t} = \mathit{\boldsymbol{w}}_c^t{\mathit{\boldsymbol{r}}^{l,t}} + \mathit{\boldsymbol{b}}_c^t\\ l = 1,2, \cdots ,L,c = 1,2, \cdots ,C \end{array}$ (12)

式中,$\mathit{\boldsymbol{w}}_c^t$$\mathit{\boldsymbol{b}}_c^t$分别为权重向量和偏置。再通过其铰链损失(Hinge loss)函数[19]$l\left( {\mathit{\boldsymbol{\bar y}}_c^{l,t},{\mathit{\boldsymbol{y}}^{l,t}}} \right) = \max \left( {0,1 - \mathit{\boldsymbol{\bar y}}_c^{l,t} \times {\mathit{\boldsymbol{y}}^{l,t}}} \right)$来构造相应的优化问题为

$\mathop {\min }\limits_{w_c^t} {\left\| {\mathit{\boldsymbol{w}}_c^t} \right\|^2} + \alpha \sum\limits_{l = 1}^L {\left( {\mathit{\boldsymbol{\bar y}}_c^{l,t},{\mathit{\boldsymbol{y}}^{l,t}}} \right)} $ (13)

求解式(13) 可得相应的$\mathit{\boldsymbol{w}}_c^t$$\mathit{\boldsymbol{b}}_c^t$

每一维的联合空间对应一个利用随机选择的样本训练的分类器。由于有$C$类图像,因此生成的联合空间就是$C$维的。

2.2.2 将所有训练图像投影到联合空间

利用SVM分类器训练好之后,将所有训练图像投影到上述这个联合空间(js)中,即

$\begin{array}{*{20}{c}} {\mathit{\boldsymbol{r}}_{t,k}^{{\rm{js}}} = \left( {\mathit{\boldsymbol{f}}_1^t\left( {{\mathit{\boldsymbol{r}}^q}} \right),\mathit{\boldsymbol{f}}_2^t\left( {{\mathit{\boldsymbol{r}}^q}} \right), \cdots ,\mathit{\boldsymbol{f}}_C^t\left( {{\mathit{\boldsymbol{r}}^q}} \right)} \right)}\\ {t = 1,2, \cdots ,T;q = 1,2, \cdots ,Q} \end{array}$ (14)

2.2.3 连接所有联合空间形成最终的图像表示

在学习好所有联合空间后,将训练图像投影到所有$T$次生成的联合空间中,并连接所有的图像特征作为最终的图像特征,即

$\mathit{\boldsymbol{r}}_k^{{\rm{js}}} = \left( {\mathit{\boldsymbol{r}}_{1,q}^{{\rm{js}}};\mathit{\boldsymbol{r}}_{2,q}^{{\rm{js}}}; \cdots ;\mathit{\boldsymbol{r}}_{T,q}^{{\rm{js}}}} \right),q = 1,2, \cdots Q$ (15)

利用式(15) 得到图像的最终特征之后,针对图像分类,即可利用此特征进行分类。线性SVM具有快速和低复杂度的优点,本文采用多类线性SVM。

2.3 算法

本文NLLSC-CI算法具体步骤如下:

1) 对初始非负特征矩阵$\mathit{\boldsymbol{X}}$和稀疏编码$\mathit{\boldsymbol{V}}$进行预处理。即$\mathit{\boldsymbol{X}} = \mathit{\boldsymbol{X}}/\max \left( {\mathit{\boldsymbol{X}}\left( : \right)} \right),\mathit{\boldsymbol{V}} = \mathit{\boldsymbol{V}}/{\left\| \mathit{\boldsymbol{V}} \right\|_1}$

2) 根据式(6) 更新稀疏编码$\mathit{\boldsymbol{V}}$

3) 标准化$\mathit{\boldsymbol{U}}$$\mathit{\boldsymbol{V}}$,即${v_{ij}} = {v_{ij}}/\sqrt {\sum\limits_i {{v_{ij}}} } ,{u_{ij}} = {u_{ij}}/\sqrt {\sum\limits_i {{u_{ij}}} } $

4) 利用共轭梯度法更新Lagrange对偶矩阵$\mathit{\boldsymbol{ \boldsymbol{\varLambda} }}$,并由式(8) 求得最优字典$\mathit{\boldsymbol{U}}$

5) 得到模板特征的$\mathit{\boldsymbol{U}}$$\mathit{\boldsymbol{V}}$之后,利用式(10) 求得新特征的稀疏编码$\mathit{\boldsymbol{S}}$

6) 根据式(11) 对得到的编码进行MP,并利用空间金字塔划分得到原始的图像表示。

7) 利用式(12) 构建基于上下文信息的联合空间,并由式(13) 得到$\mathit{\boldsymbol{w}}_c^t$$\mathit{\boldsymbol{b}}_c^t$

8) 根据式(14) 将所有训练图像投影到联合空间中。

9) 由式(15) 连接所有的联合空间,并生成最终的图像表示。

10) 利用多类线性SVM在联合空间中对图像表示进行分类。

3 实验

3.1 实验数据集

介绍4个标准的图像数据集,包括Corel-10[20]、Scene-15[21]、Caltech-101[22]和Caltech-256[23]数据集。具体如表 1所示。其中Caltech-256数据集中的部分图像如图 2所示。

表 1 4种标准图像数据集
Table 1 Four standard image datasets

下载CSV
图像数据集类数每类图像数总图像数
Corel-10101001 000
Scene-15152004004 485
Caltech-101101318009 144
Caltech-256256≥8029 780
图 2 Caltech-256数据集中部分图像
Fig. 2 Some pictures of the Caltech-256 dataset

对于这4个标准数据集,选取不同的训练样本和测试样本来进行后续的实验。具体地,对于Corel-10和Scene-15,从每一类中分别随机选取50幅和100幅图像作为训练样本,剩下的作为测试样本。而对于Caltech-101和Caltech-256,从每一类中分别随机选择15、30和15、30、45和60作为训练样本,其余的作为测试样本。

3.2 实验设置

首先,在特征提取阶段,设置16×16的窗口,步长为8提取图像的SIFT特征。对于空间金字塔划分,利用文献[4]中所提出的顶3层,即:1×1,2×2以及4×4,且每一层的权重都相同。对于字典的学习过程,固定字典的尺寸$M$=1 024。另外,在使用$K$近邻构建相似矩阵$\mathit{\boldsymbol{W}}$时,$K$=5。

其次,对于优化问题中的3个参数$\lambda ,\beta $以及$\sigma $,在文献[5-6]中,不同的图像数据集设置不同的值。例如,在LScSPM算法[6]中,Corel-10和Scene-15:$\beta $=0.2,$\lambda $=0.4;Caltech-101和Caltech-256:$\beta $=0.1,$\lambda $=0.3。Gao等人在文献[24]中固定$\beta $=0.1,$\lambda $∈[0.1,0.4]以及固定$\lambda $=0.4,$\beta $∈[0.1,0.4]。因此,可以确定:$\lambda $∈[0.1,0.4],$\beta $∈[0.1,0.4]。在本文中,通过几个不同值的比较,最后设置的是:$\lambda $=0.4,$\beta $=0.2。而对于权重衰减参数$\sigma $,令$\sigma $=100。

最后,在生成基于上下文信息的联合空间中,随机选择的图像数量$L$和次数$T$是影响实验结果的两个很重要的参数。一般来说,比较大的$T$值和$L$值能更好地表示图像,并且可以增强相应联合空间的判别力,但是同时计算复杂度也会相应地增加。为了综合考虑计算复杂度和分类准确率,本文按照文献[16]的设置,$L$=30 % $Q$$T$=30。

3.3 实验结果与分析

将上述4个公共数据集都随机分成10份,然后基于10-折交叉验证来记录本文方法的平均分类准确率与标准差;最后,将本文方法与几种经典的方法进行比较并分析相应的实验结果。表 2表 5给出了本文方法与几种稀疏编码方法包括ScSPM[5]、LScSPM、Lap-NMF-SPM[8]以及RSS[16]在上述4个标准图像数据集上的分类效果比较。

表 2 Corel-10数据集上的分类结果
Table 2 The classification performance on the Corel-10 dataset

下载CSV
/ %
算法平均分类准确率
ScSPM86.76±1.18
LScSPM88.43±0.75
Lap-NMF-SPM91.24±0.95
RSS95.72±0.78
NLLSC-CI98.57±0.69

表 3 Scene-15数据集上的分类结果
Table 3 The classification performance on the Scene-15 dataset

下载CSV
/ %
算法平均分类准确率
ScSPM81.12±0.45
LScSPM89.65±0.41
Lap-NMF-SPM90.46±0.87
RSS92.45±0.93
NLLSC-CI96.69±0.54

表 4 Caltech-101数据集上的分类结果
Table 4 The classification performance on the Caltech-101 dataset

下载CSV
/ %
算法训练图像数目
1530
ScSPM66.87±0.4572.10±1.14
LScSPM70.32±1.3574.86±0.53
Lap-NMF-SPM74.35±0.9476.81±0.49
RSS77.63±0.8982.91±0.22
NLLSC-CI80.14±0.5686.73±0.64

表 5 Caltech-256数据集上的分类结果
Table 5 The classification performance on the Caltech-256 dataset

下载CSV
/ %
算法训练图像数目
15304560
ScSPM27.53±0.4233.86±0.5537.35±1.6440.08±0.79
LScSPM29.88±0.1535.67±0.3338.37±0.4640.35±0.24
Lap-NMF-SPM35.24±0.8337.46±0.3239.87±0.7541.35±0.72
RSS40.16±0.5344.96±0.8548.25±0.4751.32±0.41
NLLSC-CI45.09±0.2148.78±0.5952.60±0.4956.45±0.32

从实验结果可以看出,NLLSC-CI方法在所有数据集上的分类准确率比其他几种方法的效果都要好。分析其原因,首先NLLSC方法通过加入非负性、局部性以及Laplacian正则化使更多相似的局部特征尽可能准确地被编码成相似的码字,这在一定程度上改善了编码的不稳定性;其次在生成基于上下文信息的联合空间阶段,本文方法综合考虑了图像特征表示和分类两个步骤,充分保留了图像的上下文信息得到更完整有效的图像表示。具体地,相比较于ScSPM、LScSPM的组合优化问题涉及加法和减法的交互运算,而减法的使用可能会使特征之间相互抵消,因此一些有用的信息也会丢失。而对于Lap-NMF-SPM方法,由于局部信息的缺失,导致图像的特性不能被准确且有效地表示出来。

另外,这3种方法中图像表示和分类是相对独立的,都没有考虑到图像的上下文信息,可能会造成图像语义信息缺失的问题。虽然RSS方法在图像表示步骤利用图像的上下文信息构建了随机语义空间,但在编码阶段利用的是传统的SC方法,这会导致编码的不稳定从而不能得到有判别力的原始图像表示。而本文方法通过添加非负性、局部性、Laplacian正则化以及图像的上下文信息,保持了更多的特征以及相似特征之间编码的一致性,从而提高了图像的分类性能。但是从数据集上来看,在Caltech-256上的分类准确率是最低的。分析其原因可以归结为数据集本身的类别太多,图像数量太庞大,类间和类内的差异性太大,因此分类时仍然不能非常准确识别对应类别的图像。从整体上看,本文的NLLSC-CI方法能显著地提高图像分类的准确率。

4 结论

本文针对编码的不稳定性以及图像表示与分类相互独立的问题,提出NLLSC-CI的图像分类算法。具体来说,NLLSC中的非负性、局部性及Laplacian正则化不仅使图像特征更多地被保留,还保持了SC的一致性和编码过程的相互依赖性。在图像表示的二阶段方法综合考虑了图像表示和分类这两个独立的过程,构建基于上下文信息的联合空间,使得图像特征之间的上下文联系被保留,且获得的上下文信息图像表示与图像分类之间相互依赖。因此,NLLSC-CI可以通过图像局部特征之间的相似依赖性能更加准确完整地模拟图像,从而提高图像的分类效果。在4个标准的图像数据集上进行了实验研究,最后的实验结果也显示了NLLSC-CI方法比目前已有算法的效果都要好。因此,可将本文方法进一步应用在图像的分割、标注等计算机视觉的其他领域。另一方面,由于本文的实验图像数据只是图像分类常用的几个标准数据集,而面向广泛的图像数据是本文工作的必要推广。另外,虽然本文方法中的上下文信息能有效传达出图像所要表达的信息,但是无法反映人类完整的思维模式,因此还需进一步改进和研究更接近人类感知和思维的图像语义内容表示方法和模型。

参考文献

  • [1] Peng T Q, Li F. Image classification algorithm based on hash codes and space pyramid[J]. Journal of Image and Graphics, 2016, 21(9): 1138–1146. [彭天强, 栗芳. 哈希编码结合空间金字塔的图像分类[J]. 中国图象图形学报, 2016, 21(9): 1138–1146. ] [DOI:10.11834/jig.20160903]
  • [2] Lowe D G. Distinctive 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]
  • [3] Sivic J, Zisserman A. Video google:a text retrieval approach to object matching in videos[C]//Proceedings of the 9th International Conference on Computer Vision. Nice, France:IEEE, 2003, 2:1470-1477.[DOI:10.1109/ICCV.2003.1238663]
  • [4] Lazebnik S, Schmid C, Ponce J. Beyond bags of features:spatial pyramid matching for recognizing natural scene categories[C]//Proceedings of 2006 IEEE Computer Society Conference on Computer Vision and Pattern Recognition. New York, USA:IEEE, 2006:2169-2178.[DOI:10.1109/CVPR.2006.68]
  • [5] Yang J C, Yu K, Gong Y H, et al. Linear spatial pyramid matching using sparse coding for image classification[C]//Proceedings of 2009 IEEE Conference on Computer Vision and Pattern Recognition. Miami, FL, USA:IEEE, 2009:1794-1801.[DOI:10.1109/CVPR.2009.5206757]
  • [6] Gao S H, Tsang I W H, Chia L T, et al. Local features are not lonely-Laplacian sparse coding for image classification[C]//Proceedings of 2010 IEEE Conference on Computer Vision and Pattern Recognition. San Francisco, CA, USA:IEEE, 2010:3555-3561.[DOI:10.1109/CVPR.2010.5539943]
  • [7] Lee D D, Seung H S. Algorithms for non-negative matrix factorization[C]//Advances in Neural Information Processing Systems 13. Massach Usetts, MA:MIT Press, 2000:556-562.
  • [8] Han H, Liu S J, Gan L. Non-negativity and dependence constrained sparse coding for image classification[J]. Journal of Visual Communication and Image Representation, 2015, 26: 247–254. [DOI:10.1016/j.jvcir.2014.12.002]
  • [9] Wang J J, Yang J C, Yu K, et al. Locality-constrained linear coding for image classification[C]//Proceedings of 2010 IEEE Conference on Computer Vision and Pattern Recognition. San Francisco, CA, USA:IEEE, 2010:3360-3367.[DOI:10.1109/CVPR.2010.5540018]
  • [10] Liu P N, Liu G J, Guo M Z, et al. Image classification based on non-negative locality-constrained linear coding[J]. Acta Automatica Sinica, 2015, 41(7): 1235–1243. [刘培娜, 刘国军, 郭茂祖, 等. 非负局部约束线性编码图像分类算法[J]. 自动化学报, 2015, 41(7): 1235–1243. ] [DOI:10.16383/j.aas.2015.c140753]
  • [11] Min H Q, Liang M J, Luo R H, et al. Laplacian regularized locality-constrained coding for image classification[J]. Neurocomputing, 2016, 171: 1486–1495. [DOI:10.1016/j.neucom.2015.07.084]
  • [12] Liu S Y, Xu D, Feng S H, et al. A novel visual words definition algorithm of image patch based on contextual semantic information[J]. Acta Electronica Sinica, 2010, 38(5): 1156–1161. [刘硕研, 须德, 冯松鹤, 等. 一种基于上下文语义信息的图像块视觉单词生成算法[J]. 电子学报, 2010, 38(5): 1156–1161. ]
  • [13] Li C Y. Research on semantic image classification based on contextual information[D]. Hangzhou:Zhejiang University, 2014. [李昌英. 基于上下文信息的语义图像分类研究[D]. 杭州: 浙江大学, 2014.]
  • [14] Sheng H D, Duan H C, Kong C. Spatial pyramid bag-of-words model for image classification based on semantic phrases[J]. Journal of Chinese Computer Systems, 2015, 36(4): 877–881. [生海迪, 段会川, 孔超. 基于语义短语的空间金字塔词袋模型图像分类方法[J]. 小型微型计算机系统, 2015, 36(4): 877–881. ]
  • [15] Zhang C J, Cheng J, Liu J, et al. Object categorization in sub-semantic space[J]. Neurocomputing, 2014, 142: 248–255. [DOI:10.1016/j.neucom.2014.03.059]
  • [16] Zhang C J, Zhu X B, Li L, et al. Joint image representation and classification in random semantic spaces[J]. Neurocomputing, 2015, 156: 79–85. [DOI:10.1016/j.neucom.2014.12.083]
  • [17] Yang S Y. Pattern Recognition and Intelligent Computing-Implementation of Matlab Technology[M]. 2nd ed. Beijing: Publishing House of Electronics Industry, 2011: 126-133. [ 杨淑莹. 模式识别与智能计算——Matlab技术实现[M]. 2版.北京: 电子工业出版社, 2011: 126-133.]
  • [18] Wu J X, Rehg J M. Beyond the euclidean distance:creating effective visual codebooks using the histogram intersection kernel[C]//Proceedings of the 12th International Conference on Computer Vision. Kyoto, Japan:IEEE, 2009:630-637.[DOI:10.1109/ICCV.2009.5459178]
  • [19] Hu J. Discussion on the theory of support vector machine[J]. Pioneering with Science & Technology Monthly, 2012, 3: 106–108. [胡骏. 支持向量机理论探讨[J]. 科技创业月刊, 2012, 3: 106–108. ] [DOI:10.3969/j.issn.1672-2272.2012.03.045]
  • [20] Lu Z W, Ip H H S. Image categorization with spatial mismatch kernels[C]//Proceedings of IEEE Conference on Computer Vision and 2009 Pattern Recognition. Miami, FL, USA:IEEE, 2009:397-404.[DOI:10.1109/CVPR.2009.5206861]
  • [21] Li F F, Perona P. A Bayesian hierarchical model for learning natural scene categories[C]//Proceedings of 2005 IEEE Computer Society Conference on Computer Vision and Pattern Recognition. San Diego, CA, USA:IEEE, 2005, 2:524-531.[DOI:10.1109/CVPR.2005.16]
  • [22] Li F F, Fergus R, Perona P. Learning generative visual models from few training examples:an incremental Bayesian approach tested on 101 object categories[J]. Computer Vision and Image Understanding, 2007, 106(1): 59–70. [DOI:10.1016/j.cviu.2005.09.012]
  • [23] Griffin G, Holub A, Perona P. Caltech-256 object category dataset[R]. Technical Report, Pasadena, USA:California Institute of Technology, 2007.
  • [24] Gao S H, Tsang I W H, Chia L T. Laplacian sparse coding, hypergraph Laplacian sparse coding, and applications[J]. IEEE Transactions on Pattern Analysis and Machine Intelligence, 2013, 35(1): 92–104. [DOI:10.1109/TPAMI.2012.63]