yhu01 / transfer-sgc

Code for "Exploiting Unsupervised Inputs for Accurate Few-Shot Classification"
9 stars 1 forks source link
few-shot-learning graph-algorithms semi-supervised-learning transfer-learning

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

CUB

CIFAR-FS

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