Skip to content

Latest commit

 

History

History
46 lines (32 loc) · 2.3 KB

README.md

File metadata and controls

46 lines (32 loc) · 2.3 KB

Towards Generalizing to Unseen Domains with Few Labels - CVPR 2024

This repository gives the official implementation of Towards Generalizing to Unseen Domains with Few Labels (CVPR 2024)

How to setup the environment

This code is built on top of Dassl.pytorch and ssdg-benchmark. Please follow the instructions provided in https://github.com/KaiyangZhou/Dassl.pytorch and https://github.com/KaiyangZhou/ssdg-benchmark to install the dassl environment, as well as to prepare the datasets.

Checkpoints

All the checkpoints for our method on top of FixMatch are available on this link.

How to run

The script is provided in ssdg-benchmark/scripts/FBASA/run_ssdg.sh. You need to update the DATA variable that points to the directory where you put the datasets. There are two input arguments: DATASET and NLAB (total number of labels).

Here we give an example. Say you want to run FBC-SA on OfficHome under the 10-labels-per-class setting (i.e. 1950 labels in total), simply run the following commands in your terminal,

conda activate dassl
cd ssdg-benchmark/scripts/FBCSA
bash run_ssdg.sh ssdg_officehome 1950 

In this case, the code will run FBC-SA in four different setups (four target domains), each for five times (five random seeds). You can modify the code to run a single experiment instead of all at once if you have multiple GPUs.

To show the results, simply do

python parse_test_res.py output/ssdg_officehome/nlab_1950/FBCSA/resnet18 --multi-exp