Home

Awesome

Multi-digit MNIST for Few-shot Learning

<p align="center"> <img src="asset/examples/multimnist_example.png" weight="1024"/> </p>

Cite this repository

@misc{mulitdigitmnist,
  author = {Sun, Shao-Hua},
  title = {Multi-digit MNIST for Few-shot Learning},
  year = {2019},
  journal = {GitHub repository},
  url = {https://github.com/shaohua0116/MultiDigitMNIST},
}

Papers that use this dataset:

Description

Multi-digit MNIST generator creates datasets consisting of handwritten digit images from MNIST for few-shot image classification and meta-learning. It simply samples images from MNIST dataset and put digits together to create images with multiple digits. It also creates training/validation/testing splits (64/20/16 classes for DoubleMNIST and 640/200/160 for TripleMNIST).

You can generate customized by following the cammands provided in Usage to change the number of images in each class, the image size, etc. You can also download generated datasets from Datasets.

This repository benchmarks the performance of MAML (Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks) using datasets created via the generation script in a variety of settings.

Some examples of images from the datasets are as follows.

Class1048596273
Image
Class039146258512874
Image

Prerequisites

Usage

Generate a DoubleMNIST dataset with 1k images for each class

python generator.py --num_image_per_class 1000 --multimnist_path ./dataset/double_mnist --num_digit 2 --image_size 64 64

Generate a TripleMNIST dataset with 1k images for each class

python generator.py --num_image_per_class 1000 --multimnist_path ./dataset/triple_mnist --num_digit 3 --image_size 84 84

Arguments

Datasets

You can download the generated datasets

DatasetImage sizeTrain/Val/Test classes# of images per classFile sizelink
DoubleMNIST(64, 64)64, 16, 20100069MBGoogle Drive
TripleMNIST(84, 84)640, 160, 2001000883MBGoogle Drive

Benchmark

This repository benchmarks training MAML (Model-Agnostic Meta-Learning for Fast Adaptation of Deep Networks) using datasets created via this generation script in a variety of settings.

Dataset/Setup5-way 1-shot5-way 5-shot20-way 1-shot20-way 1-shot
Double MNIST97.046%in progress85.461%in progress
Triple MNIST98.813%in progress96.251%in progress
Omniglot98.7%99.9%95.8%98.9%

Hyperparameters

Training

<p align="center"> <img src="asset/training.png" width="800"/> </p>

*The trainings have not fully converged and the new results will be reported once they are finished.

Author

Shao-Hua Sun