With the rise of powerful pre-trained vision-language models like CLIP, it becomes essential to investigate ways to adapt these models to downstream datasets. A recently proposed method named Context Optimization (CoOp) introduces the concept of prompt learning -- a recent trend in NLP -- to the vision domain for adapting pre-trained vision-language models. Specifically, CoOp turns context words in a prompt into a set of learnable vectors and, with only a few labeled images for learning, can achieve huge improvements over intensively-tuned manual prompts. In our study we identify a critical problem of CoOp: the learned context is not generalizable to wider unseen classes within the same dataset, suggesting that CoOp overfits base classes observed during training. To address the problem, we propose Conditional Context Optimization (CoCoOp), which extends CoOp by further learning a lightweight neural network to generate for each image an input-conditional token (vector). Compared to CoOp's static prompts, our dynamic prompts adapt to each instance and are thus less sensitive to class shift. Extensive experiments show that CoCoOp generalizes much better than CoOp to unseen classes, even showing promising transferability beyond a single dataset; and yields stronger domain generalization performance as well. Code is available at https://github.com/KaiyangZhou/CoOp.
翻译:随着像CLIP这样的强大的预先培训的视觉语言模型的崛起,必须研究如何将这些模型适应下游数据集。最近提出的一种名为“环境优化”的方法(CoOp)将即时学习的概念(NLP的最近趋势)引入到调整预先培训的视觉语言模型的视觉领域。具体地说,COP将上下文文字迅速转换成一套可学习的矢量。只有少量标签图像才能在密集调阅的手动提示上实现巨大的改进。在我们的研究中,我们发现了一个“CoOp”的关键问题:所学过的环境无法被广泛推广到同一数据集中更广泛的不可见的类中,这表明在培训期间所观察的“CoOP”基础课程是超常的。为了解决问题,我们建议“CoPoP”将“环境优化”概念(CoOOP)的概念扩展成一套轻量的神经网络,为每个图像生成一种输入-有条件的信号(Victor)。与COP的静态提示相比,我们的动态快速适应适应每个实例,因此,我们更难于每个实例,因此对于更不那么敏感地适应“COprobalalalalalalalalalalalalalalalalalal ex exalevolevolevoldealation exalationalationalationalationalationalationalationalationals exal exal exalup sholvealup ex exaless sholveal saperation exal sabal lave,显示,显示一个比一个更好的普通化的普通化的普通化的普通化,显示一个更好的普通化为一种更接近的普通的实验,显示,显示一种更具有更良好的普通的普通的成绩。