- Ubuntu 18.04.5
- Python 3.6.4
- CUDA 9.1
- PyTorch 1.6.0
conda env create --name HFKT --file environment.yml
conda activate HFKT
cd datasets
bash download_miniimagenet.sh
bash download_cub.sh
bash download_cifar_fs.sh
bash download_tieredimagenet.sh
To test in the 5-way K-shot setting:
bash scripts/test/{dataset_name}_5wKs.sh
For example, to test HFKT on the CIFAR-FS dataset in the 5-way 1-shot setting:
bash scripts/test/cifar_fs_5w1s.sh
To train in the 5-way K-shot setting:
bash scripts/train/{dataset_name}_5wKs.sh
For example, to train HFKT on the CIFAR-FS dataset in the 5-way 1-shot setting:
bash scripts/train/cifar_fs_5w1s.sh
Our project references the codes in the following repos:
- Kang et al., ReNet.
- Zhang et al., DeepEMD.
- Ye et al., FEAT
- Wang et al., Non-local neural networks
- Ramachandran et al., Stand-alone self-attention
- Huang et al., DCCNet
- Yang et al., VCN
If you find our code or paper useful to your research work, please consider citing our work using the following bibtex:
@article{zhang2023knowledge,
title={Knowledge transfer based hierarchical few-shot learning via tree-structured knowledge graph},
author={Zhang, Zhong and Wu, Zhiping and Zhao, Hong and Hu, Minjie},
journal={International Journal of Machine Learning and Cybernetics},
volume={14},
number={1},
pages={281--294},
year={2023},
publisher={Springer}
}
We adopted the main code bases from ReNet, and we really appreciate it 😃.