Giter VIP home page Giter VIP logo

r2d2's Introduction

Meta-learning with differentiable closed-form solvers.

Paper (published at ICLR 2019)

Please refer to it as:

@inproceedings{
bertinetto2018metalearning,
title={Meta-learning with differentiable closed-form solvers},
author={Luca Bertinetto and Joao F. Henriques and Philip Torr and Andrea Vedaldi},
booktitle={International Conference on Learning Representations},
year={2019},
url={https://openreview.net/forum?id=HyxnZh0ct7},
}

Data setup

  • In scripts/train/conf/fewshots.yaml, specify the location of your custom $DATASET_PATH (data.root_dir).
  • Download Omniglot, CIFAR-FS and miniImageNet the above format. Original datasets from here and here.
  • Download and extract one or more datasets in your custom $DATASET_PATH folder, the code assumes the following structure (example):
$DATASET_PATH
├── miniimagenet
│   ├── data
│   │   ├── n01532829
|   |   |── ...
│   │   └── n13133613
│   ├── splits
│   │   └── ravi-larochelle
|   |   |   ├── train.txt
|   |   |   ├── val.txt
|   |   |   └── test.txt
├── omniglot
|   ...
├── cifarfs 
|   ...

Repo setup (with Conda)

  • Set up conda environment: conda env create -f environment.yml.
  • source activate fsrr
  • Install torchnet: pip install git+https://github.com/pytorch/tnt.git@master.
  • Install the repo package: pip install -e .
  • source deactivate fsrr

Run

scripts/train/experiments.sh contains all the experiments of the paper (train+eval) in blocks of three lines, e.g.

expm_folder=mini_r2d2 
python run_train.py --log.exp_dir $expm_folder --data.dataset miniimagenet --data.way 16 --model.drop 0.1 --base_learner.init_adj_scale 1e-4 
python ../eval/run_eval.py --data.test_episodes 10000 --data.test_way 5 --data.test_shot 1 --model.model_path ../train/results/$expm_folder/best_model.1shot.t7 
python ../eval/run_eval.py --data.test_episodes 10000 --data.test_way 5 --data.test_shot 5 --model.model_path ../train/results/$expm_folder/best_model.5shot.t7

Note

Some of the files of this repository (e.g. data loading and training boilerplate routines) are the result of a modification of prototypical networks code and contain a statement in their header.

r2d2's People

Contributors

bertinetto avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

r2d2's Issues

run problem

When I run the ‘scripts/train/experiments.sh’ command, I get a ‘no run_train.py’ or 'No module named 'fewshots'' problem. Is it wrong with me running the directory? Or is it a directory structure problem with the code?

Error when running training

Hi,

I am trying to run:

expm_folder=mini_lrd2_iter1
python run_train.py --data.cuda True --log.exp_dir $expm_folder --data.dataset miniimagenet --data.way 10 --data.test_way 5 --model.drop 0.1 --data.batch_size 200 --model.groupnorm False --train.learning$

And get the following error:

RuntimeError: expand(torch.cuda.FloatTensor{[140, 1]}, size=[140]): the number of sizes provided (1) must be greater or equal to the number of dimensions in the tensor (2)

Invalid data download link

Hi, thank you so much for sharing the code!
The links for downloading miniImagenet and Omniglot are invalid (not the official ones).
Espicially for the miniImage one, how am I supposed to get the data as well as the txt files?
Thanks!

probelm when running

Hi luca,
I set up the repo like that in readme.But when I goes to "Install the repo package: pip install -e .", my terminal says"-e option requires 1 argument". What does this mean?

Accuracy gaps on CIFAR-FS dataset

Hi, thank you for sharing these well-written codes!

When I ran experiments with default setting on CIFAR-FS dataset, I notice quite large performance gaps compared to the results reported in the paper (near 4% for both 5-shot and 1-shot configurations). For the default setting, I mean the setting described in scripts/train/conf/fewshots.yaml

I checked the setting described in the paper I think it's consistent with the default setting in the repo. If the default setting is not the optimal, could you provide the optimal settings for the three datasets?

Best regards

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.