<Squeezing Backbone Feature Distributions to the Max for Efficient Few-Shot Learning>

本文提出了一种新的特征处理方法,通过欧氏归一化、幂变换和均值减法使特征向量更接近高斯分布,以提升模型精度。在小样本学习场景中,优化的传输启发式算法被引入,进一步提高性能。实验结果显示,这种方法在多种数据集、主干架构和少镜头设置下实现了最先进的精度。
摘要由CSDN通过智能技术生成

在本文中,我们提出了一种新的基于传输的方法,旨在处理特征向量,使其更接近高斯分布,从而提高了精度。
对于在训练期间可以使用未标记测试样本的转导小样本学习,我们还引入了一种优化传输启发算法,以进一步提高所达到的性能。使用标准化的视觉基准,我们展示了所提出的方法能够通过各种数据集、主干架构和少镜头设置实现最先进的精度。

Feature extraction

第一步是仅使用基础数据集训练神经网络主干模型。 在这项工作中,我们考虑了多个主干,以及各种训练程序。 一旦所考虑的主干被训练,我们就会获得强大的嵌入,这些嵌入应该很好地推广到新的类。

特征提取网络记作 f φ f_{\varphi} fφ,通过骨干提取网络的倒数第二层的输出得到。对于输入 x x x, f φ ( x ) f_{\varphi}(x) fφ(x)是一个维度为 d d d的向量,可以被认为是 x x x的一种更容易操作的表示

在使用的所有骨干架构中,倒数第二层都是通过应用ReLU函数获得的,因此所有从 f φ f_{\varphi} fφ中出来的特征数值都是非负的

Feature preprocessing

  • Euclidean normalization
    该步长将特征缩放到相同的区域,这样方差较大的特征向量不会占其他特征向量的优势。
    f φ ( x ) ← f φ ( x ) ∥ f φ ( x ) ∥ 2 f_{\varphi}(\mathbf{x}) \leftarrow \frac{f_{\varphi}(\mathbf{x})}{\left\|f_{\varphi}(\mathbf{x})\right\|_{2}} fφ(x)fφ(x)2fφ(x)

  • Power transform
    基本原理是幂变换,通常与欧几里得归一化结合使用,具有减少分布偏斜并将其映射到接近高斯分布的功能,由 β \beta β调整
    f φ h ( x ) ← ( f φ h ( x ) + ϵ ) β , β ≠ 0 f_{\varphi}^{h}(\mathbf{x}) \leftarrow\left(f_{\varphi}^{h}(\mathbf{x})+\epsilon\right)^{\beta}, \quad \beta \neq 0 fφh(x)(fφh(x)+ϵ)β,β=0
    ϵ = 1 e − 6 \epsilon=1e-6 ϵ=1e6 β \beta β是超参数

  • Mean subtraction
    使用均值减法,每个样本使用 m ∈ ( R + ) d \mathbf{m} \in\left(\mathbb{R}^{+}\right)^{d} m(R+)d投影中心进行平移。这通常与欧几里德归一化结合使用,以减少任务偏差和更好地对齐特征分布
    f φ ( x ) ← f φ ( x ) − m f_{\varphi}(\mathbf{x}) \leftarrow f_{\varphi}(\mathbf{x})-\mathbf{m} fφ(x)fφ(x)m

Boosted Min-size Sinkhorn

首先,我们定义一个权重矩阵 W W W,它有 n n n列(即每个类一列)和 d d d行(即每个特征向量维度一行),对于 W W W 中的列 j j j,我们将其表示为类 j j j的权重参数 w j ∈ R d \mathbf{w}_{j} \in \mathbb{R}^{d} wjRd,通过下面方程式计算:
w j = W [ : , j ] = c j / ∥ c j ∥ 2 , c j = 1 s ∑ x ∈ S , ℓ ( x ) = j f φ ( x ) . \begin{gathered} \mathbf{w}_{j}=\mathbf{W}[:, j]=\mathbf{c}_{j} /\left\|\mathbf{c}_{j}\right\|_{2}, \\ \mathbf{c}_{j}=\frac{1}{s} \sum_{\mathbf{x} \in \mathbf{S}, \ell(\mathbf{x})=j} f_{\varphi}(\mathbf{x}) . \end{gathered} wj=W[:,j]=cj/cj2,cj=s1xS,(x)=jfφ(x).
我们可以看到, W W W包含了每个类支持集中特征向量的平均值,然后对每个列进行 L 2 L_2 L2归一化处理,使 ∀ j , ∥ w j ∥ 2 = 1 \forall j , \left\|\mathbf{w}_{j}\right\|_{2}=1 j,wj2=1.

然后,我们迭代后面描述的多个步骤

a. Computing costs

将样本 i i i 和类别 j j j 之间的成本定义为以下对应于余弦距离的等式: C [ i , j ] ∝ ( f φ ( x i ) − w j ) 2 = 1 − w j T f φ ( x i ) \begin{aligned} \mathbf{C}[i, j] & \propto\left(f_{\varphi}\left(\mathbf{x}_{i}\right)-\mathbf{w}_{j}\right)^{2} \\ &=1-\mathbf{w}_{j}^{T} f_{\varphi}\left(\mathbf{x}_{i}\right) \end{aligned} C[i,j](fφ(xi)wj)2=1wjTfφ(xi)
对应源代码score

b. Min-size Sinkhorn

P = Sinkhorn ⁡ ( C , p , q , λ ) = argmin ⁡ P ~ ∈ U ( p , q ) ∑ i j P ~ [ i , j ] C [ i , j ] + λ H ( P ~ ) \begin{aligned} \mathbf{P} &=\operatorname{Sinkhorn}(\mathbf{C}, \mathbf{p}, \mathbf{q}, \lambda) \\ &=\underset{\tilde{\mathbf{P}} \in \mathbb{U}(\mathbf{p}, \mathbf{q})}{\operatorname{argmin}} \sum_{i j} \tilde{\mathbf{P}}[i, j] \mathbf{C}[i, j]+\lambda H(\tilde{\mathbf{P}}) \end{aligned} P=Sinkhorn(C,p,q,λ)=P~U(p,q)argminijP~[i,j]C[i,j]+λH(P~)

其中行总和为 p,列总和为 q,p 表示每个样本用于类别分配的数量的分布,q 表示分配给每个类别的样本数量的分布。
因此,U(p;q) 包含所有可能的分配方式。 在同一个等式中,C 可以看作是一个成本矩阵

P ~ \tilde{\mathbf{P}} P~的交叉熵 : H ( P ~ ) = − ∑ i j P ~ [ i , j ] log ⁡ P ~ [ i , j ] : H(\tilde{\mathbf{P}})=-\sum_{i j} \tilde{\mathbf{P}}[i, j] \log \tilde{\mathbf{P}}[i, j] :H(P~)=ijP~[i,j]logP~[i,j]

论文给出算法1,通过迭代算出 P P P.每次迭代都采用Sinkhorn算法,以便迭代更新类原型以找到它们的最佳估计
在这里插入图片描述

c. Updating weights

现在我们有了一个优化的分配矩阵 P P P,我们首先初始化权重 w j w_j wj :
w j ← u j / ∥ u j ∥ 2 u j ← ∑ i P [ i , j ] f φ ( x i ) / ∑ i P [ i , j ] \begin{gathered} \mathbf{w}_{j} \leftarrow \mathbf{u}_{j} /\left\|\mathbf{u}_{j}\right\|_{2} \\ \mathbf{u}_{j} \leftarrow \sum_{i} \mathbf{P}[i, j] f_{\varphi}\left(\mathbf{x}_{i}\right) / \sum_{i} \mathbf{P}[i, j] \end{gathered} wjuj/uj2ujiP[i,j]fφ(xi)/iP[i,j]

接下来我们通过逻辑回归进一步调整权重,通过最小化以下损失来进行优化:
1 l + u ⋅ ∑ i ∑ j − log ⁡ ( exp ⁡ ( S [ i , j ] ) ∑ γ = 1 n exp ⁡ ( S [ i , γ ] ) ) ⋅ P [ i , j ] \frac{1}{l+u} \cdot \sum_{i} \sum_{j}-\log \left(\frac{\exp (\mathbf{S}[i, j])}{\sum_{\gamma=1}^{n} \exp (\mathbf{S}[i, \gamma])}\right) \cdot \mathbf{P}[i, j] l+u1ijlog(γ=1nexp(S[i,γ])exp(S[i,j]))P[i,j]
其中, S ∈ R ( l + u ) × n \mathbf{S} \in \mathbb{R}^{(l+u) \times n} SR(l+u)×n包含 l o g i t s logits logits,其中的每个元素可以通过公式计算: S [ i , j ] = κ ⋅ w j T f φ ( x i ) ∥ w j ∥ 2 \mathbf{S}[i, j]=\kappa \cdot \frac{\mathbf{w}_{j}^{T} f_{\varphi}\left(\mathbf{x}_{i}\right)}{\left\|\mathbf{w}_{j}\right\|_{2}} S[i,j]=κwj2wjTfφ(xi).注意 κ \kappa κ是一个尺度参数,用于调整与每个样本相关的置信度指标。它是与 W 共同学习的。

部署的逻辑回归自带超参数。在实验中,我们使用梯度步长为 0:1 和 0:8 的 SGD 优化器作为动量参数,并在 e 个 epoch 上进行训练。

d. Estimating the class minimum size

现在可以细化我们对下一次迭代的min-size k k k 的估计.
为此,我们计算每个样本的预测标签: ℓ ^ ( x i ) = arg ⁡ max ⁡ j ( P [ i , j ] ) \hat{\ell}\left(\mathbf{x}_{i}\right)=\arg \max _{j}(\mathbf{P}[i, j]) ^(xi)=argmaxj(P[i,j]),可以看作是当前(临时)类的预测

然后计算 k = min ⁡ j { k j } k=\min_{j}\left\{k_{j}\right\} k=minj{kj},其中 k j k_j kj代表类 j j j的样本数

Summary of the proposed method

论文方法的所有步骤在算法2中进行了总结
在这里插入图片描述

Adversarial attacks are a major concern in the field of deep learning as they can cause misclassification and undermine the reliability of deep learning models. In recent years, researchers have proposed several techniques to improve the robustness of deep learning models against adversarial attacks. Here are some of the approaches: 1. Adversarial training: This involves generating adversarial examples during training and using them to augment the training data. This helps the model learn to be more robust to adversarial attacks. 2. Defensive distillation: This is a technique that involves training a second model to mimic the behavior of the original model. The second model is then used to make predictions, making it more difficult for an adversary to generate adversarial examples that can fool the model. 3. Feature squeezing: This involves converting the input data to a lower dimensionality, making it more difficult for an adversary to generate adversarial examples. 4. Gradient masking: This involves adding noise to the gradients during training to prevent an adversary from estimating the gradients accurately and generating adversarial examples. 5. Adversarial detection: This involves training a separate model to detect adversarial examples and reject them before they can be used to fool the main model. 6. Model compression: This involves reducing the complexity of the model, making it more difficult for an adversary to generate adversarial examples. In conclusion, improving the robustness of deep learning models against adversarial attacks is an active area of research. Researchers are continually developing new techniques and approaches to make deep learning models more resistant to adversarial attacks.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值