Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

GitHub

一,概述

当前绝大部分使用the triplet loss的工作都做了一些隐含的假设,而这些假设限制了他们在实际用例中的性能,特别是当数据集比较细粒度,包含大量类的情况下。而本文确定了其中的三个假设,并提出了相应的方法来解决它们。通过借助类间关系和类内关系,使得模型对相似的类之间的混淆更加宽容,以及惩罚不能很好反应类原型的视觉样本。该方法在四个数据集上进行了测试,包括大型的ImageNet,其性能显著高于最近的方法,甚至基于更严格假设的生成方法。

二,三个有误的隐性假设

Assumption that classes are equally different

现在许多数据集中包含非常相似的类的组合,特别是包含许多类的细粒度数据集。根据人的主观推测,在构建基于相似性的分类模型时,两个几乎无法区分的类之间的混淆不应该受到和两个非常不同的类之间的混淆同等程度的惩罚。为此,作者提出了flexible semantic margin,它考虑了类原型的一阶和二阶统计量,从而在三元组损失中引入一个反映类之间实际差异的margin。

Assumption of meaningful margin

在许多triplet loss方法中,这些模型通过设置固定值的margin来分辨可见类(对于一个可视化的样本来说,它至少应该比其他的原型与它的类原型更兼容一些,这个margin应该作为一个正则化器,减少训练集上的过拟合)。然而,视觉样本和原型之间的相似性通常是用点积来计算的,这就导致最后得出的相似性结果是无界的,可以通过增加投影视觉样本的范数来任意增大。因此,margin所施加的限制减少到可以忽略不计的程度。虽然在某些情况下这可能是可取的,但是通过任意减少正则化,它也可能会对结果模型的整体性能产生负面影响。因此作者引入了partial normalization,它权衡了直接使用提取出的特征(这为模型提供了更大的灵活性)和使用正则化的程度(这迫使最严格地使用边界)。

Assumption of class homogeneity

在一个类中,可能会存在个别样本和这个类其他样本有很大不同(比如白虎和其余老虎存在很大不同)。这种异常值的存在对学习模型有负面影响。为了解决这一问题,我们提出了relevance weighting scheme,量化训练集中每个样本的代表性。

三,Proposed approach

3.1 Standard triplet loss

A ZSL training set consists of {X, y, S}.(三元组,triplet)

  1. X = (x1, . . . , xN) ∈ RN×D represent N Ddimensional visual feature vectors,
  2. y = (y1, . . . , yN) ∈{1, . . . ,C}N the corresponding labels assigning them to one of C classes
  3. S = (s1, . . . , sC) ∈ RC×K the class prototypes.

最后,最朴素的 triplet loss如下
[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning
[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

其中M为margin,f(a,b)为计算相似性函数,[.]+ denotes the function max{0, ·}.

其实,本质来说,ZSL分类器学习的是X -> S的映射

测试阶段模型输出分类结果为

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

3.2 Flexible semantic margin

为了考虑相似和不相似类之间的区别,我们用一个函数M(c, c ')来代替式(2)中固定的margin M, M(c, c ')度量类c和c之间的差异。因为ZSL任务中,属性往往是相关的,所以需要将属性的相关性考虑进去。作者这里使用的是马氏距离。

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

其中[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning是属性的协方差矩阵的inverse

由于语义空间是高维空间,距离组合D的σD2方差较低。这是不可取的,因为太接近平均值的语义距离不支持引入可变margin。所以作者进行了如下操作rescale D。

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

3.3 Partial normalization

​ 在公式(2)中,我们直观地认为M约束模型去增加f(xn, sc)−f(xn, syn)的差值,从而更好地区分c类和yn类。

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

​ 其中,
θ()ψ() \theta()和\psi()分别为映射函数
​ 需要注意的是,通过内积得到的相似性结果是无界的,这就可能导致了M的约束没有起到该有的作用。而直接对提取到的特征向量进行全约束的话,很大程度下限制了模型的学习泛化能力。如果不限制呢,就很容易会导致过拟合问题。

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

3.4 Relevance weighting

​ 我们利用类内关系,直接考虑到了一些样本对其属于的类的代表性
[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning
[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

3.5 Final model

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

the triplet loss now takes the form:

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

The resulting final loss function is

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

​ 作者考虑了俩种不同设置计算相似性的model

  1. 把提取到的特征向量投影到语义空间
  2. 把特征向量和语义向量投影到一个共同的空间

四,Evaluation

4.1 Visual features

​ 预训练的ResNet-101,作者这里使用了数据增强,10-crop on the original images。

4.2 Metrics

​ per class accuracy [论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

4.3 效果图

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

4.4 Ablation study

[论文笔记]Modeling Inter and Intra-Class Relations in the Triplet Loss for Zero-Shot Learning

相关文章:

  • 2022-01-16
  • 2022-12-23
  • 2022-01-15
  • 2021-07-07
  • 2021-11-27
  • 2021-07-04
  • 2021-11-11
  • 2021-04-02
猜你喜欢
  • 2022-01-05
  • 2021-06-20
  • 2022-12-23
  • 2021-05-08
  • 2021-10-11
  • 2021-08-05
  • 2021-09-20
相关资源
相似解决方案