We provide a PyTorch implementation of ADM for few-shot learning. If you use this code for your research, please cite our paper.
@inproceedings{li2020ADM,
title={Asymmetric Distribution Measure for Few-shot Learning},
author={Li, Wenbin and Wang, Lei and Huo, Jing and Shi, Yinghuan and Gao, Yang and Luo, Jiebo},
booktitle={IJCAI},
year={2020}
}
Asymmetric Distribution Measure for Few-shot Learning.
Wenbin Li, Lei Wang, Jing Huo, Yinghuan Shi, Yang Gao and Jiebo Luo. In IJCAI 2020.
- Linux
- Python 3.5
- Pytorch 1.3
- GPU + CUDA CuDNN
- pillow, torchvision, scipy, numpy
- Clone this repo:
git clone https://github.com/WenbinLee/ADM.git
cd ADM
- Install PyTorch 1.3 and other dependencies.
- miniImageNet.
- tieredImageNet.
Note that all the images need to be stored into a file named "images", and the data splits are stored into "train.csv", "val.csv" and "test.csv", respectively.
- Train a 5-way 1-shot model based on Conv64F:
python Train_Batch_miniImageNet.py --dataset_dir ./datasets/miniImageNet --method_name KL --way_num 5 --shot_num 1
- Test the model (specify the dataset_dir first):
python Test_Batch.py --resume ./results/miniImageNet_DA/KL_BatchSize_4_Conv64F_miniImageNet_5Way_1Shot/model_best.pth.tar --data_name miniImageNet --method_name KL --way_num 5 --shot_num 1
- Train a 5-way 1-shot model based on Conv64F:
python Train_Batch_miniImageNet.py --dataset_dir ./datasets/tieredImageNet --method_name KL --way_num 5 --shot_num 1
- Test the model (specify the dataset_dir first):
python Test_Batch.py --resume ./results/tieredImageNet_NoDA/KL_BatchSize_4_Conv64F_tieredImageNet_5Way_1Shot/model_best.pth.tar --data_name miniImageNet --method_name KL --way_num 5 --shot_num 1
- The results on the miniImageNet and tieredImageNet datasets:
If you use this code for your research, please cite our paper.
@inproceedings{li2020ADM,
title={Asymmetric Distribution Measure for Few-shot Learning},
author={Li, Wenbin and Wang, Lei and Huo, Jing and Shi, Yinghuan and Gao, Yang and Luo, Jiebo},
booktitle={IJCAI},
year={2020}
}