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')
# Generate minibatches over the shuffled train set
for images, labels in minibatches(mnist.train, 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.4-py3-none-any.whl
(3.2 kB
view hashes)