We provide the PyTorch implementation for Test-Time Model Adaptation for Visual Question Answering with Debiased Self-Supervisions (IEEE TMM 2023).
Clone this repository:
git clone https://github.com/Zhiquan-Wen/TDS.git
cd TDS
Install PyTorch and other dependencies:
pip install -r requirements.txt
cd data
bash download.sh
python preprocess_features.py --input_tsv_folder xxx.tsv --output_h5 xxx.h5
python feature_preprocess.py --input_h5 xxx.h5 --output_path trainval
python create_dictionary.py --dataroot vqacp2/
python preprocess_text.py --dataroot vqacp2/ --version v2
cd ..
You can download the VQACP v2 dataset with Google Drive.
CUDA_VISIBLE_DEVICES=0 python TDS.py --dataroot data/vqacp2/ --img_root data/coco/trainval_features --output saved_models_cp2/test.json --batch_size 512 --learning_rate 0.01 --rate 0.2 --checkpoint_path path_for_pretrained_UpDn_model
python comput_score.py --input saved_models_cp2/test.json --dataroot data/vqacp2/
docker pull zhiquanwen/debias_vqa:v1
docker pull registry.cn-shenzhen.aliyuncs.com/wenzhiquan/debias_vqa:v1
docker tag registry.cn-shenzhen.aliyuncs.com/wenzhiquan/debias_vqa:v1 zhiquanwen/debias_vqa:v1
docker run --gpus all -it --ipc=host --network=host --shm-size 32g -v /host/path/to/data:/xxx:ro zhiquanwen/debias_vqa:v1
Download and preprocess the data
, Training
and Evaluation
steps in Getting Started
.If you found this code is useful, please cite the following paper:
@inproceedings{TDS,
title = {Test-Time Model Adaptation for Visual Question Answering with Debiased Self-Supervisions},
author = {Zhiquan Wen,
Shuaicheng Niu,
Ge Li,
Qingyao Wu,
Mingkui Tan,
Qi Wu},
booktitle = {IEEE TMM},
year = {2023}
}