Official PyTorch implementation of the paper Class-Aware Patch Embedding Adaptation for Few-Shot Image Classification.
Python 3.8, Pytorch 1.7.0, timm 0.3.2
Please follow mini-imagenet-tools to obtain the miniImageNet dataset and put it in ./datasets/mini/.
Please follow tiered-imagenet-tools to obtain the tieredImageNet dataset and put it in ./datasets/tiered/.
Please follow download_cifar_fs.sh to obtain the CIFAR-FS dataset and put it in ./datasets/cifarfs/.
Please follow download_fc100.sh to obtain the FC100 dataset and put it in ./datasets/fc100/.
Please follow https://github.com/mrkshllr/FewTURE/tree/main to pretrain the backbone ViT-small and put it in ./initialization/miniimagenet.
Please see ./run.sh.
-
Please refer to https://github.com/mrkshllr/FewTURE/tree/main to download the miniImageNet dataset and the checkpoint of the corresponding pretrained ViT-small model.
-
Put them in the corresponding folders.
-
Run ./run.sh in bash shell.
This repository is released under the Apache 2.0 license as found in the LICENSE file.
This repository is built using components of the FewTURE repository for pretraining and the FEAT repository for training and inference.
If you find this repository useful, please consider giving us a star ⭐ and cite our work:
@InProceedings{Hao_2023_ICCV,
author = {Hao, Fusheng and He, Fengxiang and Liu, Liu and Wu, Fuxiang and Tao, Dacheng and Cheng, Jun},
title = {Class-Aware Patch Embedding Adaptation for Few-Shot Image Classification},
booktitle = {Proceedings of the IEEE/CVF International Conference on Computer Vision (ICCV)},
month = {October},
year = {2023},
pages = {18905-18915}
}
If you have any questions regarding our work, please feel free to reach out!