For details see the paper (The paper has been accepted by AAAI 2023)
Official PyTorch implementation of Compositional Prototypical Networks for Few-Shot Classification
- python 3.8.13
- pytorch 1.8.0
Clone this repository:
git clone https://github.com/fikry102/CPN.git
cd CPN
Datasets can be downloaded using CUB and SUN GoogleDrive
We recommend the following structure to place the datasets:
|--data
||--cub
||--sun
|--CPN
cd scripts
#CUB, pre-training
python 01_CUB_stage1.py
#CUB, 5way 1shot, meta-training and meta-testing
python 01_CUB_stage2_5W1S.py
#CUB, 5way 5shot, meta-training and meta-testing
python 01_CUB_stage2_5W5S.py
or
sh run_cub.sh
We provide off-the-shelf models in Models GoogleDrive
This repo is based on SEGA, Dynamic Few-Shot Visual Learning without Forgetting and MetaOptNet.
Thanks for their wonderful works.
If you have any question about this project, please feel free to contact [email protected].