Download the datasets used in this project by following the instructions in the CoOp dataset guide.
Supported datasets:
- FGVCAircraft
- DTD
- EuroSAT
- Flowers102
- Food101
- OxfordPets
- StanfordCars
- UCF101
- ImageNet
Organize each dataset with the following structure:
<DATASET_NAME>/
images/
<image folders or files>
<DATASET_NAME>_annotations.json
The <DATASET_NAME>_annotations.json file should contain the train, validation, and test splits together with class names. The annotation files used in this project are available here.
Before running any command, update data.root in the files under configs/ so it points to your dataset root directory.
Train on a single dataset and evaluate on all datasets with 4 GPUs:
python -m scripts.train_and_eval --config_path configs/snd_config_4_gpus.yaml --dataset fgvc-aircraft --distributed --nproc_per_node 4Train on a single dataset with 1 GPU:
python -m scripts.train_and_eval --config_path configs/snd_config_1_gpu.yaml --dataset fgvc-aircraft --distributed --nproc_per_node 1Continue training from a previously trained dataset:
python -m scripts.train_and_eval --config_path configs/snd_config_4_gpus.yaml --pretrained_dataset fgvc-aircraft --dataset dtd --distributed --nproc_per_node 4Run continual training and evaluation over the predefined dataset sequence:
python -m scripts.continually_train --config_path configs/snd_config_4_gpus.yaml --order 0 --distributed --nproc_per_node 4Run inference with a saved checkpoint:
python -m scripts.inference --model_path outputs/order_0/checkpoint_latest.pthThis project builds on the code contribution associated with the Select and Distill paper. For the original work, see Select and Distill: Selective Dual-Teacher Knowledge Transfer for Continual Learning on Vision-Language Models.