Giter Club home page Giter Club logo

pt-map's Introduction

Leveraging the Feature Distribution in Transfer-based Few-Shot Learning

This repository is the official implementation of Leveraging the Feature Distribution in Transfer-based Few-Shot Learning.

Requirements

To install requirements:

pip install -r requirements.txt

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

To train the feature extractors in the paper, run this command:

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

Evaluation

To evaluate my model on miniImageNet/CUB/cifar/cross, run:

python test_standard.py

Pre-trained Models

You can download pretrained models and extracted features here:

  • trained models trained on miniImageNet, CUB and CIFAR-FS using WRN.

  • Create an empty 'checkpoints' directory.

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

๐Ÿ“‹ To extract and save the novel class features of a newly trained backbone, run:

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

Results

Our model achieves the following performance (backbone: WRN) on :

Dataset 1-shot Accuracy 5-shot Accuracy
miniImageNet 82.92+-0.26% 88.82+-0.13%
tieredImageNet 85.41+-0.25% 90.44+-0.14%
CUB 91.55+-0.19% 93.99+-0.10%
CIFAR-FS 87.69+-0.23% 90.68+-0.15%
cross domain 62.49+-0.32% 76.51+-0.18%

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

Sinkhorn Distances: Lightspeed Computation of Optimal Transport

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

Notes on optimal transport

pt-map's People

Contributors

giangtpham avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.