Skip to main content

Lighweight Numpy MNIST loader

Project description

mnist-async

Loads from /tmp/mnist/ after downloading any missing files.

Installation

pip install mnist

Usage

from mnist import accuracy, load_mnist, minibatches, render


# Load all the data into memory
mnist = load_mnist()

mnist.train.images  # (60000, 784)
mnist.train.labels  # (60000, 10)
mnist.test.images   # (10000, 784)
mnist.test.labels   # (10000, 10)

# Inspect the data visually
render(train_or_test='test')

# Load the train set into memory and yield minibatches from it
for images, labels in minibatches(batch_size=256, n_epochs=1):

    predicted_labels = ...

    # Calculate the accuracy of predicted class labels
    acc = accuracy(predicted_labels, labels)

Image data

Images are rows, each of length 784, and with pixel values scaled to the range zero through one.

Label data

Lables are one-hot rows each of length ten.

[0 0 1 ... 0]  # 3
[0 0 0 ... 1]  # 9

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

mnist_py-0.5-py3-none-any.whl (2.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page