dahyun-kang / renet

[ICCV'21] Official PyTorch implementation of Relational Embedding for Few-Shot Classification
https://arxiv.org/abs/2108.09666
MIT License
113 stars 17 forks source link
computer-vision deep-learning few-shot-classifcation few-shot-learning iccv2021 neural-networks pytorch

Relational Embedding for Few-Shot Classification
(ICCV 2021)

Dahyun Kang, Heeseung Kwon, Juhong Min, Minsu Cho

[paper], [project hompage]

:heavy_check_mark: Requirements

:gear: Conda environmnet installation

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

:books: Datasets

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

:deciduous_tree: Authors' checkpoints

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

:pushpin: Quick start: testing scripts

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

:fire: Training scripts

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.

:art: Few-shot classification results

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

:mag: Related repos

Our project references the codes in the following repos:

:love_letter: Acknowledgement

We adopted the main code bases from DeepEMD, and we really appreciate it :smiley:. We also sincerely thank all the ICCV reviewers, especially R#2, for valuable suggestions.

:scroll: Citing RENet

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}
}