Mark-Sky / KCL

Implement of 'The Devil is in the Few Shots: Iterative Visual Knowledge Completion for Few-shot Learning'
13 stars 2 forks source link

Datasets

Follow DATASET.md to install ImageNet and other 10 datasets referring to CoOp.

Running

You can modify the configurations in the configs/[dataset].yaml, including shots, learning rate, train epoch, etc. Here we provide the implementation of KCL on six transfer learning models including CLIP, CoOp, CLIPAdapter, Tip-Adapter, Tip-Adapter-F and MaPLe.

You can get the performance of the model without KCL by:

CUDA_VISIBLE_DEVICES=0 python main.py --config configs/[dataset].yaml --model=[model] --shots=k

For example,

CUDA_VISIBLE_DEVICES=0 python main.py --config configs/imagenet.yaml --model=CoOp --shots=1

You can run KCL by:

CUDA_VISIBLE_DEVICES=0 python main.py --config configs/[dataset].yaml --model=KCL[model] --shots=k

For example,

CUDA_VISIBLE_DEVICES=0 python main.py --config configs/imagenet.yaml --model=KCLCoOp --shots=1

Contact

Please contact zhouqf@smail.nju.edu.cn if you have any question about this project