few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读

1.cosine classifier 余弦分类器

参考:Generalized Few-Shot Object Detection without Forgetting

2.概览

小样本学习一般分为两步,第一步通过base data训练特征提取器,第二步让网络可以适配novel data。本论文也分为两步,分别如下。

2.1 第一步

通过base data训练得到分类器,分类器如下:

few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读

few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读为cosine classifier,few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读为卷积网络训练得到的特征提取器。
分类器是通过分类损失函数和一个辅助损失函数得到的。

2.2 微调backbone

冻结特征提取器few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读
随机从novel data从采样k个类,用于训练few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读,这里训练的损失函数只用到了分类损失函数。

本论文提出的方法,使用了self-supervision and regularization techniques从而使得模型更具泛化性。(说明:自监督的确 更具泛化性,就像MOCO中所提到的——自监督得到的预训练模型更具泛化性)。

我们使用rotation and exemplar两种自监督方法获取适合的feature manifold,然后通过Manifold Mixup regularization获得强劲的特征提取器backbone。

3. Manifold Mixup for Few-shot Learning

在讲Manifold Mixup之前,先将Mixup。

3.1. mixup

mixup是常见的训练集的trick。
对图像few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读和图像few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读的每个像素都进行以下操作,
few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读
其中few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读是随机从贝塔分布中选取的值,操作后来会得到一个四不像的图像,如:

few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读

然后标签few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读和标签few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读进行如下同样的操作,
few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读
得到一个四不像的标签:
例如[1, 0] -> 狗, [0, 1] -> 猫,则得到标签few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读
参考:链接

3.2.Manifold Mixup

Manifold Mixup就是将上面的图像x换成某个神经网络某层输出的特征图。如两个图片通过few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读层输出的两个特征图,记作few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读,它们与真实值的差值本论文用交叉熵表明如下:

few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读

L是交叉熵损失函数,计算预测值和真实值的差距。
few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读:是随机从贝塔分布中选取的值
few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读就是模型的预测值,few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读就是真实值
Manifold Mixup使用base data进行训练

源码中,随机选取网络的某一个层次few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读{0,1,2},对这个层次输出的特征图和标签进行插值处理。Manifold Mixup的具体操作为:设输入的batch的数据为x,将x中的图片打乱,记为few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读。然后进行
[few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读for i in x.shape[0] ]
L是交叉熵损失时,那么few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读等价于
few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读
注:如果你尝试推导上述结论,可以参考这个先对交叉熵相关知识进行学习。不过你要注意的是:few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读中的few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读不是两个数相加,few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读时经过one-hot处理的,故few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读中的few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读是两个向量相加(就是mix up中所描述的那样)。

Manifold Mixup来自论文Manifold Mixup: Better Representations by Interpolating Hidden States
可参考:Manifold Mixup和PatchUp的代码重新实现(实现即插即用且速度更快)
链接2

4. Charting the Right Manifold

通过加入自监督学习中的loss来实现Charting the Right Manifold

这里引入了两种自监督学习的pretext task——Rotation和Exemplar
Rotation(模型预测旋转的量):预测旋转角度的loss作为辅助loss被加入

few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读

few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读
L就是交叉熵函数
few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读代表图片x经过角度r的旋转。
Exemplar代表各种变换,如旋转、裁剪、变色等。
训练的目标是:使同一图片经过各种变换得到不同的图片,这些图片输出的特征向量是一样的。
将一张图片,变换出四张图片,这四张图片作为正样本,batch中的其他图片作为负样本。
loss函数如下:

few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读

D is the Euclidean distance,即对应位置相减的平方相加后来取根号
few-shot:Charting the Right Manifold: Manifold Mixup for Few-shot Learning论文阅读代表第k个变换,且label为i。

评估指标

对于cub来说
进行了600tasks,每个task的Q为15
task与Q的说明:每个task选出N个类K个样本(带有label),然后随机选择Q个没有label的样本(这Q个样本不与前面选取的N*K个样本重合),判断这Q个样本分别属于N个类中哪一个类。

其他问题

1.feature manifold是什么??

这里所提到的 feature manifold是否我们目前就是统一称为feature map或feature

看代码目标

源码
怎么训练的和论文中一致吗?损失函数是否一致,变换是否一致等。
有什么是代码里有,论文里没有的,或者说与论文中的有什么区别??
指标是否是可复现的?我复现一下。。
中兴代码,学会开启训练。。。

© 版权声明

相关文章

暂无评论

none
暂无评论...