Skip to content

FushengHao/CPEA

Repository files navigation

Class-Aware Patch Embedding Adaptation for Few-Shot Image Classification

Official PyTorch implementation of the paper Class-Aware Patch Embedding Adaptation for Few-Shot Image Classification.

Requirements

Python 3.8, Pytorch 1.7.0, timm 0.3.2

Datasets

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/.

Pretraining

Please follow https://github.com/mrkshllr/FewTURE/tree/main to pretrain the backbone ViT-small and put it in ./initialization/miniimagenet.

Training and inference

Please see ./run.sh.

Quick start 🔥

  • 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.

License

This repository is released under the Apache 2.0 license as found in the LICENSE file.

Acknowledgement

This repository is built using components of the FewTURE repository for pretraining and the FEAT repository for training and inference.

Citing CPEA

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!

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published