【提示学习论文六】MaPLe: Multi-modal Prompt Learning论文原理

MaPLe: Multi-modal Prompt Learning 多模式提示学习

文章介绍

  • 这篇文章于2023年发表在CVPR(Conference on Computer Vision and Pattern Recognition),作者是Muhammad Uzair Khattak,Hanoona Rasheed,Muhammad Maaz,Salman Khan,Fahad Shahbaz Khan。
  • 研究发现Clip的问题:在单个分支(语言或视觉)中使用prompt来调整表示是次优的,它不能在下游任务上灵活地动态调整两个表示空间。
  • 作者提出了针对视觉和语言分支的多模态提示学习(MaPLe),以改善视觉和语言表征之间的一致性。
  • 与CoCoOp方法相比更好。

动机

在这里插入图片描述

作者认为,Clip中只有文本编码器学习prompt,不足以对图像编码器所需的适应进行建模,因此着手基于多模态提示学习(MaPLe)来充分微调文本和图像编码器表示。

MaPLe:Multi-modal Prompt Learning 模型结构

在这里插入图片描述

  • 这是第一个用于微调CLIP的多模式提示方法。
  • 多模态提示是在视觉和语言分支的多个转换块中学习的,以逐步学习两种模态的协同行为。
  • 提出了耦合函数,将文本和图像编码器中的提示学习联系起来,作为两种模式之间的桥梁,允许梯度的相互传播,以促进协同作用。
  • 在视觉和语言分支的前 J J J 层( J J J < K K K )引入 learnable token。
text encoder文本编码器image encoder图像编码器
W i W_i Wiword embeddings E i E_i Eiimage embeddings
L i L_i Li某层transformer V i V_i Vi某层transformer
P i P_i Pi提示 P i P_i Pi提示
c i c_i ciclass(CLS) tokens

1、Deep Language Prompting 深度语言提示

  • 作者在 text encoder 的 J J J 层各引入了 b b b 个learnable tokens : { P i ∈ R d l {P_i \in \mathbb{R}}^{d_{l}} PiRdl} i = 1 b _{i=1}^b i=1b

  • 输入: [ P 1 , P 2 , … , P b , W 0 ] [P_1, P_2, \ldots , P_b, W_0] [P1,P2,,Pb,W0]

  • J J J:提示tokens被引入到每一层 L i L_i Li,与 W i W_i Wi 进行连接,这里的 [ ⋅ , ⋅ ] [ \cdot, \cdot] [,] 是指连接操作。(包括第 J J J 层)

[ − , W i ] = L i ( [ P i − 1 , W i − 1 ] )   i = 1 , 2 , … , J (1) \left[ -, W_i \right] = L_i \left( \left[P_{i-1}, W_{i-1}\right] \right) \text { } i = 1, 2, \ldots, J \quad \tag{1} [,Wi]=Li([Pi1,Wi1]) i=1,2,,J(1)

  • J J J没有额外的提示输入,而是处理前一层的prompt,通过自注意力机制和前馈神经网络来处理文本数据,计算最后的文本表示 z z z

[ P j , W j ] = L j ( [ P j − 1 , W j − 1 ] )   j = J + 1 , … , K (2) [P_j, W_j] = L_j \left( \left[P_{j-1}, W_{j-1}\right] \right) \text { } j = J + 1, \ldots, K \quad \tag{2} [Pj,Wj]=Lj([Pj1,Wj1]) j=J+1,,K(2)
z = TextProj ( w N K ) (3) z = \text{TextProj} \left(w_{N_K}\right) \quad \tag{3} z=TextProj(wNK)(3)

  • J = 1 J = 1 J=1提示 P P P 只应用于第一个Transformer层的输入,此时深度语言提示技术退化为CoOp

2、Deep Vision Prompting 深度视觉提示

  • 类似于深度语言提示,在 text encoder 的 J J J 层各引入了 b b b 个learnable tokens : { P i ~ ∈ R d v {\tilde{P_i} \in \mathbb{R}}^{d_{v}} Pi~Rdv} i = 1 b _{i=1}^b i=1b
  • J J J
    [ c i , E i ] = V i ( [ c i − 1 , E i − 1 , P ~ i − 1 ] )   i = 1 , 2 , … , J [c_i, E_i] = V_i([c_{i-1}, E_{i-1}, \tilde{P}_{i-1}]) \quad \text { } i = 1, 2, \ldots, J [ci,Ei]=Vi([ci1,Ei1,P~i1]) i=1,2,,J
  • J J J
    [ c j , E j , P ~ j ] = V j ( [ c j − 1 , E j − 1 , P ~ j − 1 ] )   j = J + 1 , … , K [c_j, E_j, \tilde{P}_j] = V_j([c_{j-1}, E_{j-1}, \tilde{P}_{j-1}]) \quad \text{ } j = J + 1, \ldots, K [cj,Ej,P~j]=Vj([cj1,Ej1,P~j1]) j=J+1,,K
    x = ImageProj ( c K ) x = \text{ImageProj}(c_K) x=ImageProj(cK)

3、Vision Language Prompt Coupling 视觉语言提示耦合

共享提示在两种模态之间建立联系,语言提示被引入到语言分支中的J层Transformer块中,而视觉提示通过视觉到语言的投影函数从语言提示中获得

在这里插入图片描述

  • independent V-L Prompting:独立V-L提示
  • 通过投影函数 F ( ⋅ ) F(\cdot) F()将语言提示 P i P_i Pi 映射到视觉提示 P i ~ \tilde{P_i} Pi~
  • F i F_i Fi是一个线性层,这个映射操作是一个从 d l dl dl 维到 d v dv dv 维的线性变换

提示耦合过程

  • 提示过程使用投影函数 F ( ⋅ ) F(\cdot) F() 在前 J J J 个transformer块中进行
  • 语言分支:通过 F i F_i Fi P i P_i Pi 进行映射,得到了 P i ~ \tilde{P_i} Pi~
  • 视觉分支:通过引入了调整后的视觉提示 P i ~ \tilde{P_i} Pi~,保持了分支之间的协同作用。

实验

1、通过V-L prompts prompting CLIP

在这里插入图片描述

  • shallow MaPLe(第1行)在泛化方面提供了对CoOp和Co-CoOp的持续改进。
  • 深度语言提示(第3行)比深度视觉提示(第2行)有所改善,表明在语言分支学习的提示能更好地适应CLIP。
  • 虽然单独结合上述两种方法(第4行)进一步提高了性能,但它很难从语言和视觉分支中获得综合效益。
  • MaPLe与深度提示(第4行)结合了提示在两个分支中的好处,通过在语言提示上执行视觉提示的显式条件反射来强制交互。它提供了新类和基类准确度的改进,导致最佳HM为78.55%。

2、基类到新类的泛化

在这里插入图片描述

  • 给出了MaPLe在11个识别数据集上从基类到新类的泛化设置下的性能。
  • 与最先进的Co-CoOp相比,MaPLe在所有11个数据集上的基本类和新类性能都有所提高,只有Caltech101的基本类性能略有下降。
  • 与CLIP相比,Co-CoOp仅在4/11数据集上有所提高,平均新分类准确率从74.22%降至71.69%。
  • MaPLe是一个强大的竞争对手,它在6/11数据集上的新类别上提高了CLIP的准确性,平均增益从74.22%提高到75.14%。

3、跨数据集评估

在这里插入图片描述

我们通过在所有1000个ImageNet类上学习多模态提示,然后直接将其转移到剩余的10个数据集上,来测试MaPLe的跨数据集泛化能力。MaPLe表现出有竞争力的性能,平均准确率最高,为66.30%。

4、域泛化

在这里插入图片描述
评估了ImageNet训练模型对各种域外数据集的直接可移植性,并观察到,与表5所示的所有现有方法相比,它持续提升。

5、消融实验

在这里插入图片描述

  • Prompt Depth(左):深度J对语言和视觉分支深度的影响
    MaPLe在深度为 9 时实现了最大性能
  • Prompt Length(右):提示符长度对MaPLe的影响
    随着提示符长度的增加,基类上的性能一般保持不变,而新类的准确率则下降。这表明过拟合本质上损害了对新类别的泛化。
    在这里插入图片描述
  • Effectiveness of Multi-modal Prompting:多模式提示的有效性

在这里插入图片描述

  • Prompting complexity:提示复杂度
    MaPLe提供了更好的推理和训练速度,MaPLe†的参数比MaPLe小约9倍,MaPLe†对所有层prompt使用统一的V-L耦合函数,比MaPLe少约9倍的参数,但性能差异不大。

总结

大规模V-L模型(例如CLIP)对下游任务的适应是一个具有挑战性的问题,因为大量的可调参数和有限的下游数据集大小。提示学习是一种高效且可扩展的技术,可以根据新的下游任务定制V-L模型。为此,目前的提示学习方法要么只考虑视觉方面的提示,要么只考虑语言方面的提示。我们的工作表明,对视觉和语言分支进行提示是至关重要的,以使V-L模型适当地适应下游任务。此外,我们提出了一种策略,通过在不同的transformer阶段将视觉提示明确地限制在文本提示上,来确保视觉语言模式之间的协同作用。我们的方法提高了对新类别、跨数据集迁移和具有域迁移的数据集的泛化能力。

  • 25
    点赞
  • 22
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Back in 2003, when I wanted to implement charts for my home page, Flash-based charting solutions were totally dominating the market. I resented the idea of meeting my nontechnical readers with a prompt to install a browser plugin just to view my content, so I went looking for other solutions. There were server-side libraries that produced a static chart image, but they didn't provide any form of interactivity. So I built a chart based on an image created dynamically on the server, overlaid with tool tips created in JavaScript. This still runs on my website and has survived the coming of the touch age without modification. But I still had an idea of something simpler. By 2006 all major browsers had support for vector graphics through either SVG or VML, so this seemed the way to go. I started working on Highcharts on weekends and vacations, and released it in 2009. It was an instant success. Today, three years later, it has grown to become the preferred web charting engine by many, perhaps most, developers. Our bootstrapper company has nine persons working full time on developing, marketing, and selling Highcharts, and we have sold more than 22,000 licenses. Our clients include more than half of the 100 greatest companies in the world. I was thrilled when Packt Publishing contacted me for reviewing this book. I soon realized that the author, Joe Kuan, has a tight grip on Highcharts, jQuery, and general JavaScript. He also does what I love the most to see from Highcharts users—he bends, tweaks, and configures the library, and creates charts that surpass what we even thought possible with our tool. All done step by step in increasingly complex examples. I can't wait to recommend this book to our users. Torstein Hønsi CTO, Founder Highsoft Solutions

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值