Home

Awesome

Cascade Prompt Learning for Vision-Language Model Adaptation [ECCV 2024]

Cascade Prompt Learning for Vision-Language Model Adaptation<br> Ge Wu*, Xin Zhang*, Zheng Li, Zhaowei Chen, Jiajun Liang, Jian Yang Xiang Li *Joint first authors

paper slides

<hr />

News

(September 2024) Training codes of CasPL+PromptSRC will be released.

(July 2024) Our work is accepted to ECCV 2024!

<hr />

Cascade Prompt Learning

Highlights

  1. We propose a novel cascade prompt learning framework consisting of both boosting and adapting prompt phases. To our best knowledge, CasPL is the first to introduce cascaded diverse prompts with multiple phases for VLMs, which is a brand new learning paradigm for fine-tuning VLMs.
  2. We demonstrate that the boosting prompts can distill domain-general knowledge from the senior teacher over massive unlabeled domain images, leading to superior recognition performance and efficient inference.
  3. As a plug-and-play framework, CasPL can be seamlessly integrated into any existing prompt learning approaches, with negligible parameters (boosting prompt tokens, <0.1%) and ignorable additional inference cost introduced.

Framework

<div style="text-align:center"><img src="docs/fig2.jpg" width="100%" ></div> <figcaption class="content has-text-left" style="word-break:normal">Figure 1. An overview of CasPL framework. <strong>(a)</strong> We utilize a set of boosting prompts to enable the student CLIP model to extract general domain knowledge from the teacher CLIP model, leveraging an extensive amount of unlabeled domain data. <strong>(b)</strong> The boosting prompt can be seamlessly incorporated into existing related work as a plug-in. Here, we exemplify this integration with PromptSRC, where frozen boosting prompts are cascaded with learnable adapting prompts without altering any loss function. </figcaption>

Results

Base-to-Novel: Results reported below show accuracy for base and novel classes for across 11 recognition datasets averaged over 3 seeds.

NameBase Acc.Novel Acc.HM
CLIP69.3474.2271.70
CoOp82.6963.2271.66
CoOp+CasPL84.7874.4979.30 (+7.64)
CoCoOp80.4771.6975.83
CoCoOp+CasPL83.6378.1280.78 (+4.95)
MaPLe82.2875.1478.55
MaPLe+CasPL84.4879.5981.96 (+3.41)
PromptSRC84.2676.1079.97
PromptSRC+CasPL86.1179.5482.69 (+2.72)

Few-shot: Results reported below show accuracy across 11 recognition datasets averaged over 3 seeds.

Name1 shot2 shot4 shot8 shot16 shot
Linear probe CLIP45.8357.9868.0174.4778.79
CoOp67.5670.6574.0276.9879.89
CoCoOp66.7967.6571.2172.9674.90
MaPLe69.2772.5875.3778.8981.79
PromptSRC72.3275.2978.3580.6982.87
PromptSRC+CasPL75.9177.9480.4582.2284.49
<hr />

Running

Installation

For installation and other package requirements, please follow the instructions detailed in INSTALL.md.

Data Preparation

Please follow the instructions at DATASETS.md to prepare all datasets.

Training

(1) Base-to-Novel Experiments.

python train_script/caspl_promptsrc/train_base_to_new.py

train_base_to_new.py contains two-stage training, and the other experimental files also contain two-stage training:

bash scripts/ivlp/base2new_train_ivlp_teacher.sh #the first stage to get the boosting prompt
bash scripts/caspl/promptsrc/base2new_train_promptsrc_student.sh #the second stage to train the adapting prompt

(2) Few-shots Experiments.

python train_script/caspl_promptsrc/train_few_shot.py

(3) Cross-dataset Experiments.

python train_script/caspl_promptsrc/train_cross_dataset.py
<hr />

Citation

If you find our work, this repository, or pretrained models useful, please consider giving a star and citation.

Contact

If you have any questions, please create an issue on this repository or contact at gewu.nku@gmail.com.

Acknowledgements

Our code is based on PromptSRC, along with Co-CoOp and CoOp repository. We thank the authors for releasing their code. If you use our model and code, please consider citing these works as well.