Skip to content

albietz/infimnist_py

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

infimnist_py

Python binding for the infinite MNIST dataset generator of L. Bottou (see http://leon.bottou.org/projects/infimnist), written in Cython. A tensorflow queue for real-time data generation is also provided in infimnist_queue.py.

Installation

You need to copy (or symlink) the data/ directory from the original infimnist project folder (available here) into the root folder of this repo.

Build the cython extension with:

python setup.py build_ext -if

Example usage

The following code gives the first test example (0), the first training example (10000) and its first transformation (70000). The indexing logic follows that of the original infimnist binary described here.

import _infimnist as infimnist
import numpy as np

mnist = infimnist.InfimnistGenerator()
indexes = np.array([0, 10000, 70000], dtype=np.int64)
digits, labels = mnist.gen(indexes)

# example of preprocessing from [0, 255] to [0., 1.]
X = digits.astype(np.float32).reshape(indexes.shape[0], 28, 28)
X = X / 255

import matplotlib.pyplot as plt
plt.imshow(X[0])
plt.title('label: {}'.format(labels[0]))

About

Python binding for the infinite MNIST dataset generator

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published