• Stars
    star
    197
  • Rank 197,722 (Top 4 %)
  • Language
    Python
  • Created over 6 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

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

MAML-TensorFlow

An elegant and efficient implementation for ICML2017 paper: Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks

Highlights

  • adopted from cbfin's official implementation with equivalent performance on mini-imagenet
  • clean, tiny code style and very easy-to-follow from comments almost every lines
  • faster and trivial improvements, eg. 0.335s per epoch comparing with 0.563s per epoch, saving up to 3.8 hours for total 60,000 training process

How-TO

  1. Download mini-Imagenet from here and extract them as :
	miniimagenet/	
	├── images	
		├── n0210891500001298.jpg  		
		├── n0287152500001298.jpg 		
		...		
	├── test.csv	
	├── val.csv	
	└── train.csv	
	└── proc_images.py
	

then replace the path by your actual path in data_generator.py:

		metatrain_folder = config.get('metatrain_folder', '/hdd1/liangqu/datasets/miniimagenet/train')
		if True:
			metaval_folder = config.get('metaval_folder', '/hdd1/liangqu/datasets/miniimagenet/test')
		else:
			metaval_folder = config.get('metaval_folder', '/hdd1/liangqu/datasets/miniimagenet/val')
  1. resize all raw images to 84x84 size by
python proc_images.py
  1. train
python main.py

Since tf.summary is time-consuming, I turn it off by default. uncomment the 2 lines to turn it on:

	# write graph to tensorboard
	# tb = tf.summary.FileWriter(os.path.join('logs', 'mini'), sess.graph)

	...
	# summ_op
	# tb.add_summary(result[1], iteration)

and then minitor training process by:

tensorboard --logdir logs
  1. test
python main.py --test

As MAML need generate 200,000 train/eval episodes before training, which usually takes up to 6~8 minutes, I use an cache file filelist.pkl to dump all these episodes for the first time and then next time the program will load from the cached file. It only takes several seconds to load from cached files.

generating episodes: 100%|█████████████████████████████████████████| 200000/200000 [04:38<00:00, 717.27it/s]

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

MAML-Pytorch

Elegant PyTorch implementation of paper Model-Agnostic Meta-Learning (MAML)
Python
2,308
star
5

awesome-meta-learning

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

GCN-PyTorch

Graph Convolution Network for PyTorch
Python
388
star
7

LearningToCompare-Pytorch

Pytorch Implementation for CVPR2018 Paper: Learning to Compare: Relation Network for Few-Shot Learning
Python
250
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