This code implements the Multi-scale Adaptive Task Attention Network (MATANet).
Our code will be released soon.
If you find our work useful, please consider citing our work using the bibtex:
@Article{chen2020multi,
author = {Chen, Haoxing and Li, Huaxiong and Li, Yaohui and Chen, Chunlin},
title = {Multi-scale Adaptive Task Attention Network for Few-Shot Learning},
journal = {arXiv preprint arXiv:2011.14479},
year = {2020},
}
- Linux
- Python 3.6
- Pytorch 1.0+
- GPU + CUDA CuDNN
- pillow, torchvision, scipy, numpy
Dataset download link:
Note: You need to manually change the dataset directory.
- Train a 5-way 1-shot model based on Conv-64F:
python MATA_Train_5way1shot.py --dataset_dir ./datasets/miniImageNet --data_name miniImageNet
Test model on the test set:
python MATA_Test_5way1shot.py --dataset_dir ./datasets/miniImageNet --data_name miniImageNet --resume ./results/MATA_miniImageNet_MATA64_5Way_1Shot/model_best_test.pth.tar
- Data preprocessing (e.g., CUB-200-2011).
- Run the preprocessing script.
python ./dataset/CUB_200_2011_preprocessing.py
- Train a 5-way 1-shot model based on Conv-64F:
python MATA_Train_5way1shot.py --dataset_dir ./datasets/CUB_200_2011 --data_name CUBBirds
Test model on the test set:
python MATA_Test_5way1shot.py --dataset_dir ./datasets/CUB_200_2011 --data_name CUBBirds --resume ./results/MATA_CUBBirds_MATA64_5Way_1Shot/model_best_test.pth.tar
We also provide some of the pre-trained models. You can run the following command to evaluate the model
python MATA_Test_5way1shot_fg.py --dataset_dir ./datasets/CUB_200_2011 --data_name CUBBirds --resume ./results/MATA_CUBBirds_MATA64_5Way_1Shot/model_best_test.pth.tar
Please feel free to contact us if you have any problems.
Email: haoxingchen@smail.nju.edu.cn