Home

Awesome

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

A few-shot classification algorithm: Charting the Right Manifold: Manifold Mixup for Few-shot Learning

Our code is built upon the code base of A Closer Look at Few-shot Classification and Manifold Mixup: Better Representations by Interpolating Hidden States

Running the code

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

miniImageNet

CUB

CIFAR-FS

Training

DATASETNAME: miniImagenet/cifar/CUB/tieredImagenet

METHODNAME: S2M2_R/rotation/manifold_mixup

For CIFAR-10

python train_cifar.py --method [METHODNAME] --model WideResNet28_10 --batch_size <batch_size> --stop_epoch <stop_epoch>

For miniImagenet/CUB/tieredImagenet

python train.py --dataset [DATASETNAME] --method [METHODNAME] --model WideResNet28_10 --batch_size <batch_size> --stop_epoch <stop_epoch>

Example Training script to replicate our result on CUB Dataset:

Fetching pretrained WideResNet_28_10 model checkpoints for evaluation

Directory path to save models should be: checkpoints/[DATASETNAME]/WideResNet28_10_[METHODNAME]/

Pre-trained mdoels can be downloadeded from https://drive.google.com/open?id=1S-t56H8YWzMn3sjemBcwMtGuuUxZnvb_. Move the tar files for each dataset into 'checkpoints' folder and untar it if required.

Few-shot evaluation

Create an empty 'features' directory inside 'S2M2'

python save_features.py --dataset [DATASETNAME] --method [METHODNAME] --model WideResNet28_10
python test.py --dataset [DATASETNAME] --method [METHODNAME] --model WideResNet28_10 --n_shot [1/5]

Features of pre-trained network can also be be directly downloaded at this link 'https://drive.google.com/open?id=1JtA7p3sDPksvBmOsJuR4EHw9zRHnKurj' for easy evaluation without the need to download datasets and models. Move the tar files for each dataset into 'features' folder and untar it.

Comparison with prior/current state-of-the-art methods on mini-ImageNet, CUB and CIFAR-FS dataset.

Note: We implemented LEO on CUB dataset. Other numbers are reported directly from the paper.

Methodmini-ImageNetCUBCIFAR-FS
1-shot5-shot1-shot5-shot1-shot5-shot
Baseline++57.33 +- 0.1072.99 +- 0.4370.4 +- 0.8182.92 +-0.7867.5 +- 0.6480.08 +- 0.32
LEO61.76 +- 0.0877.59 +- 0.1268.22+- 0.2278.27 +- 0.16--
DCO62.64 +- 0.6178.63 +- 0.46--72.0 +- 0.784.2 +- 0.5
Manifold Mixup57.6 +- 0.1775.89 +- 0.1373.47 +- 0.8985.42 +- 0.5369.20 +- 0.283.42 +- 0.15
Rotation63.9 +- 0.1881.03 +- 0.1177.61 +- 0.8689.32 +- 0.4670.66 +- 0.284.15 +- 0.14
S2M2_R64.93 +- 0.1883.18 +- 0.1180.68 +- 0.8190.85 +- 0.4474.81 +- 0.1987.47 +- 0.13

If you use this code for your research, Please cite using

@inproceedings{mangla2020charting,
  title={Charting the right manifold: Manifold mixup for few-shot learning},
  author={Mangla, Puneet and Kumari, Nupur and Sinha, Abhishek and Singh, Mayank and Krishnamurthy, Balaji and Balasubramanian, Vineeth N},
  booktitle={The IEEE Winter Conference on Applications of Computer Vision},
  pages={2218--2227},
  year={2020}
}

References

A Closer Look at Few-shot Classification

Meta-Learning with Latent Embedding Optimization

Meta Learning with Differentiable Convex Optimization

Manifold Mixup: Better Representations by Interpolating Hidden States