1. Classification losses

每次输入一个样本,对样本进行类别预测,根据预测类别和真实标签得到对应的分类损失。

2. Pairwise losses

每次输入两个样本,数据集包含了这两个样本是否相似的信息。计算损失时根据模型在这两个样本上的输出和相似信息进行计算。

3. Triplet losses

每次输入三个样本,\(x, x_-, x_+\)。其中\(x_-和x_+\)分别为\(x\)的负样本(不相似)和正样本(相似)。根据这三个数据在模型的输出以及对应的相似信息得到损失。

Quadruplet losses

每次输入四个数据,这四个数据都是不同的,其中包含了一对相似数据和一对不相似数据。根据四个数据在模型的输出和对应的相似信息得到损失。

疑问

  • 不同losses之间的优缺点以及适用场景。

参考

  • Ustinova E, Lempitsky V. Learning Deep Embeddings with Histogram Loss[J]. 2016.

Classification losses. It has been observed in [8] and confirmed later in multiple works (e.g. [15])
that deep networks trained for classification can be used for deep embedding. In particular, it is
sufficient to consider an intermediate representation arising in one of the last layers of the deep
network. The normalization is added post-hoc. Many of the works mentioned below pre-train their
embeddings as a part of the classification networks.
Pairwise losses. Methods that use pairwise losses sample pairs of training points and score them
independently. The pioneering work on deep embeddings [3] penalizes the deviation from the unit
cosine similarity for positive pairs and the deviation from -1 or -0:9 for negative pairs. Perhaps,
the most popular of pairwise losses is the contrastive loss [5, 20], which minimizes the distances in
the positive pairs and tries to maximize the distances in the negative pairs as long as these distances
are smaller than some margin M. Several works pointed to the fact that attempting to collapse all
positive pairs may lead to excessive overfitting and therefore suggested losses that mitigate this
effect, e.g. a double-margin contrastive loss [12], which drops to zero for positive pairs as long as
their distances fall beyond the second (smaller) margin. Finally, several works use non-hinge based
pairwise losses such as log-sum-exp and cross-entropy on the similarity values that softly encourage
the similarity to be high for positive values and low for negative values (e.g. [24, 27]). The main
problem with pairwise losses is that the margin parameters might be hard to tune, especially since
the distributions of distances or similarities can be changing dramatically as the learning progresses.
While most works “skip” the burn-in period by initializing the embedding to a network pre-trained for classification [24], [22] further demonstrated the benefit of admixing the classification loss during
the fine-tuning stage (which brings in another parameter).
Triplet losses. While pairwise losses care about the absolute values of distances of positive and
negative pairs, the quality of embeddings ultimately depends on the relative ordering between positive
and negative distances (or similarities). Indeed, the embedding meets the needs of most practical
applications as long as the similarities of positive pairs are greater than similarities of negative pairs
[19, 26]. The most popular class of losses for metric learning therefore consider triplets of points
x0; x+; x-, where x0; x+ form a positive pair and x0; x- form a negative pair and measure the
difference in their distances or similarities. Triplet-based loss can then e.g. be aggregated over all
triplets using a hinge function of these differences. Triplet-based losses are popular for large-scale
embedding learning [4] and in particular for deep embeddings [13, 14, 17, 21, 28]. Setting the margin
in the triplet hinge-loss still represents the challenge, as well as sampling “correct” triplets, since the
majority of them quickly become associated with zero loss. On the other hand, focusing sampling on
the hardest triplets can prevent efficient learning [17]. Triplet-based losses generally make learning
less constrained than pairwise losses. This is because for a low-loss embedding, the characteristic
distance separating positive and negative pairs can vary across the embedding space (depending on
the location of x0), which is not possible for pairwise losses. In some situations, such added flexibility
can increase overfitting.
Quadruplet losses. Quadruplet-based losses are similar to triplet-based losses as they are computed
by looking at the differences in distances/similarities of positive pairs and negative pairs. In the case
of quadruplet-based losses, the compared positive and negative pairs do not share a common point
(as they do for triplet-based losses). Quadruplet-based losses do not allow the flexibility of tripletbased losses discussed above (as they includes comparisons of positive and negative pairs located in
different parts of the embedding space). At the same time, they are not as rigid as pairwise losses, as
they only penalize the relative ordering for negative pairs and positive pairs. Nevertheless, despite
these appealing properties, quadruplet-based losses remain rarely-used and confined to “shallow”
embeddings [9, 30]. We are unaware of deep embedding approaches using quadruplet losses. A
potential problem with quadruplet-based losses in the large-scale setting is that the number of all
quadruplets is even larger than the number of triplets. Among all groups of losses, our approach
is most related to quadruplet-based ones, and can be seen as a way to organize learning of deep
embeddings with a quarduplet-based loss in an efficient and (almost) parameter-free manner.

四种losses的更多相关文章

  1. 两个变量交换的四种方法(Java)

    对于两种变量的交换,我发现四种方法,下面我用Java来演示一下. 1.利用第三个变量交换数值,简单的方法. (代码演示一下) class TestEV //创建一个类 { public static ...

  2. Android开发之基本控件和详解四种布局方式

    Android中的控件的使用方式和iOS中控件的使用方式基本相同,都是事件驱动.给控件添加事件也有接口回调和委托代理的方式.今天这篇博客就总结一下Android中常用的基本控件以及布局方式.说到布局方 ...

  3. TCP四种计时器

    TCP共使用以下四种计时器,即重传计时器.坚持计时器.保活计时器和时间等待计时器 .这几个计时器的主要特点如下:      1.重传计时器      当TCP发送报文段时,就创建该特定报文段的重传计时 ...

  4. C++四种类型转换方式。

    类型转换有c风格的,当然还有c++风格的.c风格的转换的格式很简单(TYPE)EXPRESSION,但是c风格的类型转换有不少的缺点,有的时候用c风格的转换是不合适的,因为它可以在任意类型之间转换,比 ...

  5. C#批量插入数据到Sqlserver中的四种方式

    我的新书ASP.NET MVC企业级实战预计明年2月份出版,感谢大家关注! 本篇,我将来讲解一下在Sqlserver中批量插入数据. 先创建一个用来测试的数据库和表,为了让插入数据更快,表中主键采用的 ...

  6. 织梦DedeCMS模板防盗的四种方法

    织梦(DedeCMS)模板也是一种财富,不想自己辛辛苦苦做的模板被盗用,在互联网上出现一些和自己一模一样的网站,就需要做好模板防盗.本文是No牛收集整理自网络,不过网上的版本都没有提供 Nginx 3 ...

  7. 四种比较简单的图像显著性区域特征提取方法原理及实现-----> AC/HC/LC/FT。

    laviewpbt  2014.8.4 编辑 Email:laviewpbt@sina.com   QQ:33184777 最近闲来蛋痛,看了一些显著性检测的文章,只是简单的看看,并没有深入的研究,以 ...

  8. 像画笔一样慢慢画出Path的三种方法(补充第四种)

    今天大家在群里大家非常热闹的讨论像画笔一样慢慢画出Path的这种效果该如何实现. 北京-LGL 博客号@ligl007发起了这个话题.然后各路高手踊跃发表意见.最后雷叔 上海-雷蒙 博客号@雷蒙之星 ...

  9. 让一个图片在div中居中(四种方法)

    第一种方法: <div class="title"> <div class="flag"></div> <div cl ...

随机推荐

  1. 2-4 R语言基础 列表

    #列表list > l1 <- list("a",2,10L,3+4i,TRUE) #每个元素没有名字> l1[[1]][1] "a" [[2 ...

  2. MySQL数据类型字节长度

    1.字符串 char(n): n 字节长度 varchar(n): 如果是 utf8 编码, 则是 3 n + 2字节; 如果是 utf8mb4 编码, 则是 4 n + 2 字节. 2.数值类型: ...

  3. 关于CAN总线的被动错误标志的问题?

    关于CAN总线的被动错误标志的问题? 关于CAN总线的被动错误标志,协议中的描述是"处于被动错误状态的单元检测出错误时,输出被动错误标志". 对此有几个疑问: 1.被动错误标志的发 ...

  4. 关于开发React Native的注意事项

    今天在写一个简单的RN的Demo时,一连出现了好几个错误,最后幸亏得以解决,在这里把我踩过的坑以及解决办法分享出来: 1.运行出现错误:Could not connect to development ...

  5. 9.Libraries and visibility 库和可见性

    import和liabrary指令可以帮助你创建模块化,可复用的代码.库不仅仅提供API,也是一个私有化单元:库中已下划线(_)开头的类都是对外不可访问的.每个Dart的应用也是一个包,尽管它没有使用 ...

  6. 20155237 第十一周java课堂程序

    20155237 第十一周java课堂程序 内容一:后缀表达式 abcde/-f+ 内容二:实现Linux下dc的功能,计算后缀表达式的值 填充下列代码: import java.util.Scann ...

  7. 20155333 《网络对抗》Exp2 后门原理与实践

    20155333 <网络对抗>Exp2 后门原理与实践 1.例举你能想到的一个后门进入到你系统中的可能方式? 下载的软件中捆绑有后门: 浏览的网页或其上的小广告: 有些网页会自动安装软件. ...

  8. 20155337 《网络对抗》 Exp2 后门原理与实践

    20155337 <网络对抗> Exp2 后门原理与实践 一.基础问题回答 - 例举你能想到的一个后门进入到你系统中的可能方式? 在Unix里,login程序通常用来对telnet来的用户 ...

  9. sinopia 搭建记录

    最近公司有个问题,一些公共部分每次都要手动发送,放到 git 上涉及到父子 git 问题,现在就想在内部搭建一个 npm,涉及到公共模块了就直接 npm update 更新一下.找到了 sinopia ...

  10. 奔跑吧vivado

        上一节一上来就是Linux,不是炫耀我们的MiZ702能跑Linux,而是为了方便的把外设一次性测试完.大家都知道MiZ702精华在于FPGA与ARM的完美融合,就像太极一样阴阳调和--软中有 ...