Thanks to visit codestin.com
Credit goes to github.com

Skip to content
/ TAPT Public

[CVPR 2025] TAPT: Test-Time Adversarial Prompt Tuning for Robust Inference in Vision-Language Models

License

Notifications You must be signed in to change notification settings

xinwong/TAPT

Repository files navigation

TAPT: Test-Time Adversarial Prompt Tuning for Robust Inference in Vision-Language Models

Official PyTorch implementation of the following paper:

TAPT: Test-Time Adversarial Prompt Tuning for Robust Inference in Vision-Language Models,

Xin Wang1, Kai Chen1, Jiaming Zhang2, Jingjing Chen1, Xingun Ma1
1Shanghai Key Lab of Intell. Info. Processing, School of CS, Fudan University
2Hong Kong University of Science and Technology


Environment Setup

To set up the required environment, please follow the installation instructions provided in the Train-Time APT repository.

Data Preparation

Before training or evaluating the models, you'll need to prepare the necessary datasets. Detailed instructions on downloading, preprocessing, and organizing the data can be found in DATASETS.md.

ADV_DIR can be generated using the Train-Time APT repository.

Training and Evaluation

This project provides scripts for test-time tuning and evaluating various prompt designs. You can find all scripts in the ./scripts directory.

Example Usage

Here are examples of how to train and evaluate different Test-Time Adversarial Prompt Tuning using a ViT-B/16 backbone in a zero-shot setting:

  • TAPT-VLI (Test-Time Adversarial V-L Independent Prompt):

    ./scripts/vlip/TAPT_VLI_0shots_step1_eps1.sh
  • TAPT-VLJ (Test-Time Adversarial V-L Joint Prompt):

    ./scripts/vljp/TAPT_VLJ_0shots_step1_eps1.sh
    

Acknowledgement

This repository is built upon PromptAlign and TPT. Thanks for those well-organized codebases.

Citation

@inproceedings{wang2025tapt,
  title={TAPT: Test-Time Adversarial Prompt Tuning for Robust Inference in Vision-Language Models},
  author={Wang, Xin and Chen, Kai and Zhang, Jiaming and Chen, Jingjing and Ma, Xingjun},
  booktitle={Proceedings of the Computer Vision and Pattern Recognition Conference},
  pages={19910--19920},
  year={2025}
}

About

[CVPR 2025] TAPT: Test-Time Adversarial Prompt Tuning for Robust Inference in Vision-Language Models

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published