[论文解读] Tip-Adapter: Training-free Adaption of CLIP for Few-shot Classification
该论文提出Tip-Adapter,一种无需训练的方法,通过使用少量支持图像及其标签的非参数化键值缓存,增强CLIP在少样本图像分类中的性能。该方法在推理过程中通过特征相似性检索相关少样本知识,并通过残差连接将结果与CLIP的零样本预测相结合,实现与微调模型相当的性能,且训练成本为零;同时,仅对缓存进行20个训练周期的微调即可进一步提升准确率。
Contrastive Vision-Language Pre-training, known as CLIP, has provided a new paradigm for learning visual representations using large-scale image-text pairs. It shows impressive performance on downstream tasks by zero-shot knowledge transfer. To further enhance CLIP's adaption capability, existing methods proposed to fine-tune additional learnable modules, which significantly improves the few-shot performance but introduces extra training time and computational resources. In this paper, we propose a training-free adaption method for CLIP to conduct few-shot classification, termed as Tip-Adapter, which not only inherits the training-free advantage of zero-shot CLIP but also performs comparably to those training-required approaches. Tip-Adapter constructs the adapter via a key-value cache model from the few-shot training set, and updates the prior knowledge encoded in CLIP by feature retrieval. On top of that, the performance of Tip-Adapter can be further boosted to be state-of-the-art on ImageNet by fine-tuning the cache model for 10$ imes$ fewer epochs than existing methods, which is both effective and efficient. We conduct extensive experiments of few-shot classification on 11 datasets to demonstrate the superiority of our proposed methods. Code is released at https://github.com/gaopengcuhk/Tip-Adapter.
研究动机与目标
- 为解决零样本CLIP在少样本分类中的局限性,实现无需微调的有效适应。
- 设计一种轻量级、非参数化的适配器,利用少样本支持数据而不更新CLIP的权重。
- 仅在缓存模型上进行20个训练周期的微调,即可在ImageNet上实现最先进性能,显著降低训练成本。
- 证明从缓存的少样本数据集中检索知识,可在精度-效率权衡上媲美甚至超越微调方法。
提出的方法
- 从少量支持图像及其独热编码标签构建键值缓存,其中键为CLIP嵌入的特征,值为类别标签。
- 在推理过程中,计算测试图像的CLIP特征与缓存键之间的余弦相似度,以检索相关标签预测。
- 聚合缓存中检索到的标签预测,并通过残差连接将其与CLIP原始的零样本预测相结合。
- 引入Tip-Adapter-F,仅对缓存键进行微调(不更新CLIP权重或标签),实现性能提升且训练量极小。
- 采用ViT-Large作为CLIP视觉主干网络,并在整个过程中保持CLIP编码器冻结,确保参数效率。
- 推理和微调均仅使用单张GPU,Tip-Adapter-F的训练时间以分钟计。
实验结果
研究问题
- RQ1非参数化、无需训练的适配器能否在少样本图像分类中媲美微调模型?
- RQ2缓存支持集的特征和标签是否能在不更新CLIP参数的情况下实现有效的知识迁移?
- RQ3仅对缓存键进行微调,能否在极大缩短训练时间下实现最先进性能?
- RQ4Tip-Adapter的性能增益在与CLIP预训练分布存在不同领域差距的数据集上如何变化?
主要发现
- Tip-Adapter在16-shot ImageNet上达到62.03%的top-1准确率,相比零样本CLIP提升1.70%,且无需任何训练。
- Tip-Adapter-F仅在缓存上微调20个周期,16-shot ImageNet上的准确率达到65.51%,超越零样本CLIP以及微调的CoOp和CLIP-Adapter。
- 在11个多样化的少样本数据集上,Tip-Adapter相比零样本CLIP的中位性能提升超过10%,在EuroSAT上提升33.02%,在Flowers102上提升23.87%。
- 微调CLIP的视觉或文本编码器会导致性能崩溃或下降,而仅微调缓存键则能实现稳定且显著的性能提升。
- Tip-Adapter-F仅使用620万参数和6分钟训练时间,ImageNet上达到79.4%的准确率,优于在完整数据集上训练的DeiT-S(79.9%)和ResNet-50(74.2%)。
- 该方法保持每张图像10.42ms的推理速度和2227MiB的GPU显存占用,与零样本CLIP相当,展现出高效率。
阅读本论文
在 Nubint 阅读器中打开原文,边读边就任意段落提问。
在 Nubint 中阅读本论文本解读由 AI 根据论文原文生成,引用前请核对原文。