论文阅读:Deep Metric Learning via Lifted Structured Feature Embedding

首先,介绍一下embedding的概念(该思想参考自知乎):

Embedding在数学上表示一个maping: f: X \rightarrow Y , 也就是一个function。其中该函数满足两个性质:

  1. injective (单射的):就是我们所说的单射函数,每个Y只有唯一的X对应;
  2. structure-preserving(结构保存):比如在X所属的空间上 x_{1}\leq x_{2} ,那么映射后在Y所属空间上同理 y_{1}\leq y_{2}

那么对于word embedding, 就是找到一个映射(函数)将单词(word)映射到另外一个空间(其中这个映射具有injective和structure-preserving的特点), 生成在一个新的空间上的表达,该表达就是word representation。

摘要:本文提出一种距离度量的方法,充分的发挥 training batches 的优势,by lifting the vector of pairwise distances within the batch to the matrix of pairwise distances. 刚开始看这个摘要,有点懵逼,不怕,后面会知道这段英文是啥意思的。

  引言部分开头讲了距离相似性度量的重要性,并且应用广泛。这里提到了三元组损失函数 (triplet loss),就是讲在训练的过程当中,尽可能的拉近两个相同物体之间的距离,而拉远不同物体之间的距离;这种做法会比普通的训练方法得到更好的效果。但是,文章中提到,现有的三元组方法却无法充分利用 minibatch SGD training 的 training batches 的优势。现有的方法首先随机的采样图像对或者三元组,构建训练 batches, 计算每一个 pairs or triplets 的损失。本文提出一种方法,称为:lifts,将 the vector of pairwise distances 转换成 the matrix of pairwise distance. 然后在 lifts problem 上设计了一个新的结构损失目标。结果表明,在 GoogleLeNet network 上取得了比其他方法都要好的结果。 

 

  然后作者简单的回顾了一下关于判别性训练网络(discriminatively training networks)来学习 semantic embedding。大致结构预览图如下所示:

  首先是: Contrastive embedding. 

  这种方法在 paired data (xi,xj,yij)上进行训练。这种 contrastive training 最小化具有相同 label 类别的样本之间的距离,然后对不同label的样本,但是其距离小于 α的 negative pair 给予惩罚。代价函数的定义为:

 

  其中,m 代表batch中图像的个数,f(*)是网路输出的特征,即原文中表达的:the feature embedding output from the network. Di,j是两个样本特征之间欧式距离的度量。标签 yi,j0,1表明是否样本对来自同一个类别。[]+操作是 the hinge function max(0, *)。

 第二个是:Triplet embedding

  这个就是著名的三元组损失函数了,即:找一个 anchor,然后找一个正样本,一个负样本。训练的目的就是:鼓励网络找到一个 embedding 使得 xa and xn 之间的距离大于 xa and xp 加上一个 margin α的和。损失函数定义为:

  其中,D仍然表示样本之间特征的距离。

         然后就是本文提出的一种度量方法了:

  Deep metric learning via lifted structured feature embedding. 

   我们基于训练集合的正负样本,定义了一个结构化的损失函数:  

  其中,P 是正样本的集合,N 是负样本的集合。这个函数提出了两个计算上的挑战:

  1. 非平滑(non-smooth)

  2. 评价和计算其子梯度需要最小化所有样本对若干次。

 

  我们以两种方式解决了上述挑战:

  首先,我们优化上述函数的一个平滑上界;

  第二,对于大数据常用的方法类似,我们采用随机的方法。

  然而,前人的工作都是用SGD的方法,随机的均匀的选择 pairs or triplets。我们的方法从这之中得到了借鉴:

    (1). it biases the sample towards including "difficult" pairs, just like a subgradient of Ji,j

would use the close negative pairs; 

  (2). 一次采样就充分的利用了一个 mini-batch的全部信息,而不仅仅是两个pair之间的信息。 

 

  为了充分的利用这个 batch,一个关键的 idea 是增强 mini-batch 的优化以利用所有的pairs。

  需要注意的是:随机采样的样本对之间的 negative edges 携带了非常有限的信息。

  

  所以,我们的方法改为并非完全随机,而是引入了重要性采样的元素。我们随机的采样了一些 positive pairs,然后添加了一些他们的 difficult neighbors 来训练 mini-batch. 这个增强增加了子梯度会用到的相关信息。下图展示了一个 positive pair 在一个 batch 中的搜索过程,即:在一个 positive pair 的图像中,我们找到其 close(hard)negative images。  

  注意到我们的方法可以从两端开始搜索,而三元组则仅仅只能和定义好的结构上的元素进行搜索。

 

 

  

 

 

 

   此外,搜索 single hardest negative with nested max function 实际上会导致网络收敛到一个 bad local optimum. 所以我们采用了如下的 smooth upper bound,所以 我们的损失函数定义为:  

 

  其中,P是batch中 positive pairs 集合,N 是negative pairs 的集合。后向传播梯度可以如算法1所示的那样,对应距离的梯度为:

  

    其中的 1[*] 是指示函数,如果括号内的判断为真,那么输出为1,否则就是0. 

  本文的算法流程图,如下所示:

 

 

  


  结果展示:

 

 

 

  

 

 

 


 

    文章总结

  可以看出,本文是在三元组损失函数基础上的一个改进。并非仅仅考虑预先定义好的样本之间的差异性,而是考虑到一个 batches 内部 所有的样本之间的差异。在这个过程中,文章中引入了类似 hard negative mining 的思想,考虑到正负样本之间的难易程度。并且为了避免网络的训练陷入到 局部最优的bug中去,引入了损失函数的上界来缓解这个问题。

  一个看似不大的改动,却可以发到CVPR,也从某个角度说明了这个方法的价值。

 

  难道,三元组损失函数就这样被这个算法击败了? 自己当初看到三元组损失函数的时候,为什么就没有往这个方向去思考呢???

  还有一个疑问是:为什么这种方法的操作,称为:lifted structured feature embedding ? 

  难道说,是因为这个左右移动的搜索 hard negative samples 的过程类似于电梯(lift)?那 feature embedding 怎么理解呢? embedding 是映射,难道是:特征映射么??

 文章参考自:https://www.cnblogs.com/wangxiaocvpr/p/5921074.html

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Part I Metric Searching in a Nutshell Overview 3 1. FOUNDATIONS OF METRIC SPACE SEARCHING 5 1 The Distance Searching Problem 6 2 The Metric Space 8 3 Distance Measures 9 3.1 Minkowski Distances 10 3.2 Quadratic Form Distance 11 3.3 Edit Distance 12 3.4 Tree Edit Distance 13 3.5 Jaccard’s Coefficient 13 3.6 Hausdorff Distance 14 3.7 Time Complexity 14 4 Similarity Queries 15 4.1 Range Query 15 4.2 Nearest Neighbor Query 16 4.3 Reverse Nearest Neighbor Query 17 4.4 Similarity Join 17 4.5 Combinations of Queries 18 4.6 Complex Similarity Queries 18 5 Basic Partitioning Principles 20 5.1 Ball Partitioning 20 5.2 Generalized Hyperplane Partitioning 21 5.3 Excluded Middle Partitioning 21 5.4 Extensions 21 6 Principles of Similarity Query Execution 22 6.1 Basic Strategies 22 6.2 Incremental Similarity Search 25 7 Policies for Avoiding Distance Computations 26 7.1 Explanatory Example 27 7.2 Object-Pivot Distance Constraint 28 7.3 Range-Pivot Distance Constraint 30 7.4 Pivot-Pivot Distance Constraint 31 7.5 Double-Pivot Distance Constraint 33 7.6 Pivot Filtering 34 8 Metric Space Transformations 35 8.1 Metric Hierarchies 36 8.1.1 Lower-Bounding Functions 36 8.2 User-Defined Metric Functions 38 8.2.1 Searching Using Lower-Bounding Functions 38 8.3 Embedding Metric Space 39 8.3.1 Embedding Examples 39 8.3.2 Reducing Dimensionality 40 9 Approximate Similarity Search 41 9.1 Principles 41 9.2 Generic Algorithms 44 9.3 Measures of Performance 46 9.3.1 Improvement in Efficiency 46 9.3.2 Precision and Recall 46 9.3.3 Relative Error on Distances 48 9.3.4 Position Error 49 10 Advanced Issues 50 10.1 Statistics on Metric Datasets 51 10.1.1 Distribution and Density Functions 51 10.1.2 Distance Distribution and Density 52 10.1.3 Homogeneity of Viewpoints 54 10.2 Proximity of Ball Regions 55 10.3 Performance Prediction 58 Contents ix 10.4 Tree Quality Measures 60 10.5 Choosing Reference Points 63 2. SURVEY OF EXISTING APPROACHES 67 1 Ball Partitioning Methods 67 1.1 Burkhard-Keller Tree 68 1.2 Fixed Queries Tree 69 1.3 Fixed Queries Array 70 1.4 Vantage Point Tree 72 1.4.1 Multi-Way Vantage Point Tree 74 1.5 Excluded Middle Vantage Point Forest 75 2 Generalized Hyperplane Partitioning Approaches 76 2.1 Bisector Tree 76 2.2 Generalized Hyperplane Tree 77 3 Exploiting Pre-Computed Distances 78 3.1 AESA 78 3.2 Linear AESA 79 3.3 Other Methods 80 4 Hybrid Indexing Approaches 81 4.1 Multi Vantage Point Tree 81 4.2 Geometric Near-neighbor Access Tree 82 4.3 Spatial Approximation Tree 85 4.4 M-tree 87 4.5 Similarity Hashing 88 5 Approximate Similarity Search 89 5.1 Exploiting Space Transformations 89 5.2 Approximate Nearest Neighbors with BBD Trees 90 5.3 Angle Property Technique 92 5.4 Clustering for Indexing 94 5.5 Vector Quantization Index 95 5.6 Buoy Indexing 97 5.7 Hierarchical Decomposition of Metric Spaces 97 5.7.1 Relative Error Approximation 98 5.7.2 Good Fraction Approximation 98 5.7.3 Small Chance Improvement Approximation 98 5.7.4 Proximity-Based Approximation 99 5.7.5 PAC Nearest Neighbor Search 99 x SIMILARITY SEARCH Part II Metric Searching in Large Collections of Data Overview 103 3. CENTRALIZED INDEX STRUCTURES 105 1 M-tree Family 105 1.1 The M-tree 105 1.2 Bulk-Loading Algorithm of M-tree 109 1.3 Multi-Way Insertion Algorithm 112 1.4 The Slim Tree 113 1.4.1 Slim-Down Algorithm 114 1.4.2 Generalized Slim-Down Algorithm 116 1.5 Pivoting M-tree 118 1.6 The M
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值