Skip to content
Few shot learning
Python Shell
Branch: master
Clone or download
Latest commit a3e79f8 Jun 19, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
asset initial release Jun 17, 2019
configs/demo initial release Jun 17, 2019
core make code more clean Jun 18, 2019
dataset initial release Jun 18, 2019
tools tidy up codebase Jun 18, 2019
.gitignore update readme Jun 18, 2019
DATASET.md initial release Jun 18, 2019
LICENSE initial release Jun 17, 2019
README.md make code more clean Jun 18, 2019
__init__.py initial release Jun 17, 2019
main.py make code more clean Jun 18, 2019

README.md

Category Traversal Module for Few-shot Learning

A PyTorch implementation of our paper "Finding Task-Relevant Features for Few-Shot Learning by Category Traversal", published at CVPR 2019, an ORAL presentation.

By Hongyang Li, David Eigen, Samuel Dodge, Matthew Zeiler, and Xiaogang Wang.

[arXiv Paper] [Poster]

[End-of-internship Presentation Slides] (40 mins)

[Short Slides] (5 mins at CVPR)

(a) describes the conventional metric-based methods and (b) depicts the proposed CTM where features are traversed across categories for acquiring better representations.

The following figure shows a detailed configuration of our proposed CTM module.

Overview

  • PyTorch 0.4 or above, tested in Linux/cluster/multi/single-gpu(s).
  • Datasets: tieredImagenet and miniImagenet
  • A metric-based few-shot learning algorithm
  • The proposed Category Traversal Module (CTM) serves as a plug-and-play unit to most existing methods, with ~2% improvement in accuracy.

Install

There are some dependencies; be sure to install the newer version to be compatible with the latest pytorch. For example:

conda install -c anaconda pillow

Prepare the dataset (miniImageNet for example):

sh dataset/get_tier_and_mini.sh

How to run

python main.py --yaml_file configs/demo/mini/20way_1shot.yaml

Datasets

We conduct all the experiments on tieredImagenet and miniImagenet benchmarks; to download them, please refer to DATASET.md.

Adapting CTM module to your own task

Please refer to forward_CTM method in the core/model.py file for details.

The current version contains some legacy variable names in early trial experiments; we would remove them later and make the repo cleaner.

Citation

Please cite in the following manner if you find it useful in your research:

@inproceedings{li2019ctm,
  title = {{Finding Task-Relevant Features for Few-Shot Learning by Category Traversal}},
  author = {Hongyang Li and David Eigen and Samuel Dodge and Matthew Zeiler and Xiaogang Wang},
  booktitle = {CVPR},
  year = {2019}
}
You can’t perform that action at this time.