- Ubuntu 16.04
- Python 3.7
- CUDA 11.0
- PyTorch 1.7.1
conda env create --name renet_iccv21 --file environment.yml
conda activate renet_iccv21
cd datasets
bash download_miniimagenet.sh
bash download_cub.sh
bash download_cifar_fs.sh
bash download_tieredimagenet.sh
cd checkpoints
bash download_checkpoints_renet.sh
The file structure should be as follows:
renet/
├── datasets/
├── model/
├── scripts/
├── checkpoints/
│ ├── cifar_fs/
│ ├── cub/
│ ├── miniimagenet/
│ └── tieredimagenet/
train.py
test.py
README.md
environment.yml
To test in the 5-way K-shot setting:
bash scripts/test/{dataset_name}_5wKs.sh
For example, to test ReNet on the miniImagenet dataset in the 5-way 1-shot setting:
bash scripts/test/miniimagenet_5w1s.sh
To train in the 5-way K-shot setting:
bash scripts/train/{dataset_name}_5wKs.sh
For example, to train ReNet on the CUB dataset in the 5-way 1-shot setting:
bash scripts/train/cub_5w1s.sh
Training & testing a 5-way 1-shot model on the CUB dataset using a TitanRTX 3090 GPU takes 41m 30s.
Experimental results on few-shot classification datasets with ResNet-12 backbone. We report average results with 2,000 randomly sampled episodes.
datasets | miniImageNet | tieredImageNet | ||
setups | 5-way 1-shot | 5-way 5-shot | 5-way 1-shot | 5-way 5-shot |
accuracy | 67.60 | 82.58 | 71.61 | 85.28 |
datasets | CUB-200-2011 | CIFAR-FS | ||
setups | 5-way 1-shot | 5-way 5-shot | 5-way 1-shot | 5-way 5-shot |
accuracy | 79.49 | 91.11 | 74.51 | 86.60 |
Our project references the codes in the following repos:
- 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
We adopted the main code bases from DeepEMD, and we really appreciate it 😃. We also sincerely thank all the ICCV reviewers, especially R#2, for valuable suggestions.
If you find our code or paper useful to your research work, please consider citing our work using the following bibtex:
@inproceedings{kang2021renet,
author = {Kang, Dahyun and Kwon, Heeseung and Min, Juhong and Cho, Minsu},
title = {Relational Embedding for Few-Shot Classification},
booktitle= {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
year = {2021}
}