• Stars
    star
    2,308
  • Rank 19,952 (Top 0.4 %)
  • Language
    Python
  • License
    MIT License
  • Created almost 7 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Elegant PyTorch implementation of paper Model-Agnostic Meta-Learning (MAML)

MAML-Pytorch

PyTorch implementation of the supervised learning experiments from the paper: Model-Agnostic Meta-Learning (MAML).

Version 1.0: Both MiniImagenet and Omniglot Datasets are supported! Have Fun~

Version 2.0: Re-write meta learner and basic learner. Solved some serious bugs in version 1.0.

For Tensorflow Implementation, please visit official HERE and simplier version HERE.

For First-Order Approximation Implementation, Reptile namely, please visit HERE.

heart

Platform

  • python: 3.x
  • Pytorch: 0.4+

MiniImagenet

Howto

For 5-way 1-shot exp., it allocates nearly 6GB GPU memory.

  1. download MiniImagenet dataset from here, splitting: train/val/test.csv from here.
  2. extract it like:
miniimagenet/
├── images
	├── n0210891500001298.jpg  
	├── n0287152500001298.jpg 
	...
├── test.csv
├── val.csv
└── train.csv

  1. modify the path in miniimagenet_train.py:
        mini = MiniImagenet('miniimagenet/', mode='train', n_way=args.n_way, k_shot=args.k_spt,
                    k_query=args.k_qry,
                    batchsz=10000, resize=args.imgsz)
		...
        mini_test = MiniImagenet('miniimagenet/', mode='test', n_way=args.n_way, k_shot=args.k_spt,
                    k_query=args.k_qry,
                    batchsz=100, resize=args.imgsz)

to your actual data path.

  1. just run python miniimagenet_train.py and the running screenshot is as follows: screenshot-miniimagetnet

If your reproducation perf. is not so good, maybe you can enlarge your training epoch to get longer training. And MAML is notorious for its hard training. Therefore, this implementation only provide you a basic start point to begin your research. and the performance below is true and achieved on my machine.

Benchmark

Model Fine Tune 5-way Acc. 20-way Acc.
1-shot 5-shot 1-shot 5-shot
Matching Nets N 43.56% 55.31% 17.31% 22.69%
Meta-LSTM 43.44% 60.60% 16.70% 26.06%
MAML Y 48.7% 63.11% 16.49% 19.29%
Ours Y 46.2% 60.3% - -

Ominiglot

Howto

run python omniglot_train.py, the program will download omniglot dataset automatically.

decrease the value of args.task_num to fit your GPU memory capacity.

For 5-way 1-shot exp., it allocates nearly 3GB GPU memory.

Refer to this Rep.

@misc{MAML_Pytorch,
  author = {Liangqu Long},
  title = {MAML-Pytorch Implementation},
  year = {2018},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/dragen1860/MAML-Pytorch}},
  commit = {master}
}

More Repositories

1

Deep-Learning-with-TensorFlow-book

深度学习入门开源书,基于TensorFlow 2.0案例实战。Open source Deep Learning book, based on TensorFlow 2.0 framework.
Jupyter Notebook
13,194
star
2

TensorFlow-2.x-Tutorials

TensorFlow 2.x version's Tutorials and Examples, including CNN, RNN, GAN, Auto-Encoders, FasterRCNN, GPT, BERT examples, etc. TF 2.0版入门实例代码,实战教程。
Jupyter Notebook
6,377
star
3

Deep-Learning-with-PyTorch-Tutorials

深度学习与PyTorch入门实战视频教程 配套源代码和PPT
Python
2,834
star
4

awesome-meta-learning

A curated list of Meta-Learning resources/papers.
554
star
5

GCN-PyTorch

Graph Convolution Network for PyTorch
Python
388
star
6

LearningToCompare-Pytorch

Pytorch Implementation for CVPR2018 Paper: Learning to Compare: Relation Network for Few-Shot Learning
Python
250
star
7

MAML-TensorFlow

Faster and elegant TensorFlow Implementation of paper: Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks
Python
197
star
8

Reptile-Pytorch

Python
150
star
9

Deep-Learning-with-PyTorch-book

PyTorch深度学习开源电子书
131
star
10

awesome-AutoML

A curated list of AutoML papers/tutorials/slides etc.
90
star
11

DARTS-PyTorch

PyTorch 1.0 supported for CNN exp.
Python
82
star
12

pytorch-mnist-vae

Pytorch Implementation of variational auto-encoder for MNIST
Python
60
star
13

DeepEmbeddingModel_ZSL-Pytorch

Pytorch code for CVPR 2017 paper: Learning a Deep Embedding Model for Zero-Shot Learning
Python
59
star
14

GCN-TF2

Graph Convolution Network for TensorFlow 2 implementation.
Python
51
star
15

CapsNet-Pytorch

Pytorch version of Hinton's Capsule Theory paper: Dynamic Routing Between Capsules
Python
45
star
16

IntroVAE-Pytorch

Pytorch Implementation for paper: IntroVAE: Introspective Variational Autoencoders for Photographic Image Synthesis
Python
39
star
17

MAML-Pytorch-RL

Python
32
star
18

Graph-Neural-Network-Papers

Curated Lists for graph neural network, graph convolutional network, graph attention network, etc.
27
star
19

PPO-Pytorch

Pytorch Implementation of Proximal Policy Optimization Algorithm
Python
20
star
20

awesome-causal-reasoning

15
star
21

PracticalDeepLearningTutorials

深度学习算法实战
Jupyter Notebook
14
star
22

Meta-Learning-Papers

Latest papers collection of thoughtful work on meta-learning research
6
star
23

DRL-tutorial

Deep Reinforcement Learning tutorials
Python
5
star
24

GAN

Pytorch Implementations for popular GAN algorithms.
Python
5
star
25

memoryGAN-Tensorflow

Python
5
star
26

dragen1860.github.io

Personal website on github
HTML
4
star
27

Learning-from-data-Subtitles-

Learning from data 英文字幕 Caltech's Machine Learning Course - CS 156 by Professor Yaser Abu-Mostafa
4
star
28

PhoneNet

Fast, Efficient and Elegant Android Neural Network Library with strong GPU acceleration, implemented CNN, Squeezenet yet.
Java
4
star
29

Casual-Reasoning-Papers

Papers collection of latest insightful work on casual reasoning research.
4
star
30

NTM-Pytorch

Neural Turing Machine or Differentiable Neural Computer Implementation in Pytorch 0.4.0, with cuda
Python
4
star
31

PytorchTutorialsCN

3
star
32

LSH

Standard Locality Sensitive Hashing
C++
3
star
33

Coarse_ImageNet_Labels

2
star
34

AutoPyTorch

2
star
35

Pytorch-Episode

Notes about some advanced usage or easy-wrong highlights about Pytorch
Jupyter Notebook
2
star
36

FaceScore

C++
2
star
37

CACTU

Python
2
star
38

MetaLab

Universal Meta Learning Library, with PyTorch GPU Acceleration.
Python
1
star
39

Network3

Python
1
star
40

TRPO-Pytorch

Python
1
star
41

memoryGAN-Pytorch

Repository for ICLR 2018 paper: memoryGAN
1
star
42

Network2

Python
1
star
43

DLUtils

Useful Utils code for deep learning development
Python
1
star