8000 GitHub - TomSheng21/R-TPT: CVPR 2025 - R-TPT: Improving Adversarial Robustness of Vision-Language Models through Test-Time Prompt Tuning
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

CVPR 2025 - R-TPT: Improving Adversarial Robustness of Vision-Language Models through Test-Time Prompt Tuning

Notifications You must be signed in to change notification settings

TomSheng21/R-TPT

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Code for R-TPT

Our implementation is based on TPT and adversarial-attacks-pytorch.

Framework:

Prerequisites:

  • python == 3.8.5
  • pytorch == 1.12.1
  • torchvision == 0.13.1

Dataset:

Please follow CoOp and manually download the require datasets. Replace /path/to/dataset with your dataset folder root in below commands and check the path of json file in fewshot_datasets.py.

Test-time adaptation:

  1. Adaptation on clean dataset (R-TPT)
    python rtpt.py /path/to/dataset --test_sets DTD -a RN50 -b 64 --gpu 0 --ctx_init a_photo_of_a -p 50 --eps 0.0 --output_dir 'output_results/rtpt'
  2. Adaptation on adversarial dataset (R-TPT)
    python rtpt.py /path/to/dataset --test_sets DTD -a RN50 -b 64 --gpu 0 --ctx_init a_photo_of_a -p 50 --eps 1.0 --step 7 --output_dir 'output_results/rtpt'
  3. Test-time adaptation based on TeCoA pretrained encoder:

    If you want to load TeCoA pretrained encoder, please download the TeCoA from this repo and copy it into pretrain/tecoa folder, and the command is:

    python rtpt.py /path/to/dataset --test_sets DTD -a RN50 -b 64 --gpu 0 --ctx_init a_photo_of_a -p 50 --eps 1.0 --step 7 --output_dir 'output_results/rtpt' --load_tecoa 'RN50-eps1'

About

CVPR 2025 - R-TPT: Improving Adversarial Robustness of Vision-Language Models through Test-Time Prompt Tuning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

0