Skip to content

woodszp/MACF

Repository files navigation

Multi-granularity Awareness via Cross Fusion for Few-Shot Learning

✔️ Requirements

⚙️ Conda environmnet installation

conda env create --name MACF --file environment.yml
conda activate MACF

📚 Datasets

cd datasets
bash download_miniimagenet.sh
bash download_cub.sh
bash download_cifar_fs.sh
bash download_tieredimagenet.sh

📌 Quick start: testing scripts

To test in the 5-way K-shot setting:

bash scripts/test/{dataset_name}_5wKs.sh

For example, to test MACF on the cub dataset in the 5-way 5-shot setting:

bash scripts/test/cub_5w5s.sh
python test.py -dataset cub -datadir /home/data/cub -gpu 0 -extra_dir cub_5w5s -temperature_attn 5.0 

We will update the full code once the paper is accepted.

🔥 Training scripts

To train in the 5-way K-shot setting:

bash scripts/train/{dataset_name}_5wKs.sh

For example, to train MACF on the CIFAR-FS dataset in the 5-way 1-shot setting:

bash scripts/train/cifar_fs_5w1s.sh
python train.py -batch 64 -dataset cifar_fs -datadir /home/data/cifar_fs -gpu 0 -extra_dir your_run_set -temperature_attn 5.0 -lamb 0.5

Releases

No releases published

Packages

No packages published