Skip to content

Code for "Exploiting Unsupervised Inputs for Accurate Few-Shot Classification"

Notifications You must be signed in to change notification settings

yhu01/transfer-sgc

Repository files navigation

Exploiting Unsupervised Inputs for Accurate Few-Shot Classification

A few-shot classification algorithm: Exploiting Unsupervised Inputs for Accurate Few-Shot Classification

Running the code

Dataset: miniImageNet, CUB, CIFAR-FS

Donwloading the dataset and create base/val/novel splits:

miniImageNet

  • Change directory to filelists/miniImagenet/
  • Run 'source ./download_miniImagenet.sh'

CUB

  • Change directory to filelists/CUB/
  • Run 'source ./download_CUB.sh'

CIFAR-FS

  • Download CIFAR-FS
  • Decompress and change the filename to 'cifar-FS'
  • Move the datafile to filelists/cifar/
  • Run 'python write_cifar_filelist.py'

Training backbone

For miniImageNet/CUB

python train.py --dataset [miniImagenet/CUB] --method [S2M2_R/rotation] --model [WideResNet28_10/ResNet18] --train_aug

For CIFAR-FS

python train_cifar.py --dataset cifar --method [S2M2_R/rotation] --model [WideResNet28_10/ResNet18] --train_aug

Saving the novel class features of a trained backbone for the evaluation

python save_plk.py --dataset [miniImagenet/CUB] --method S2M2_R --model [WideResNet28_10/ResNet18]

Fetching trained WideResNet_28_10 backbones and saved novel class features

Create an empty 'checkpoints' directory inside 'transfer-sgc'

The backbone and features for each dataset can be downloaded from this link: 'https://drive.google.com/file/d/1wVJlDnU00Gurs0pw54ZMqf4XsWhJWHIh/view?usp=sharing '

Untar the downloaded file and move it into 'checkpoints' folder.

Evaluating the few-shot classification performance

python test_standard.py

References

A Closer Look at Few-shot Classification

Charting the Right Manifold: Manifold Mixup for Few-shot Learning

Manifold Mixup: Better Representations by Interpolating Hidden States

SimpleShot: Revisiting Nearest-Neighbor Classification for Few-Shot Learning

Simplifying Graph Conv Neural Network

About

Code for "Exploiting Unsupervised Inputs for Accurate Few-Shot Classification"

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages