Skip to content

matiasvlevi/easy-mnist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

easy-mnist

easy-mnist allows you to easily access the popular MNIST dataset.

Install

npm i easy-mnist

Get Started

Here is how you would get a training & testing set.

const mnist = require('easy-mnist')
                .makeData(60000, 10000);

mnist.train[index].label
mnist.train[index].image

mnist.test[index].label
mnist.test[index].image

or you can get the entire 70 000 mnist digits in one set.

const mnist = require('easy-mnist')
                .Load();

mnist[index].label
mnist[index].image

Format

Label format

The index of 1 is the correct label.

console.log(mnist.train[0].label);
// outputs:
//  [0,0,0,0,0,1,0,0,0,0]
Image format

The white values are 1 and black values are 0.

console.log(mnist.train[0].image);
// outputs:
//  array (length of 784)

Batches

You can also make your dataset with batches.

const mnist = require('easy-mnist')
                .makeBatch(100);

this will create a dataset with 100 length batches for the training & testing set.

Shuffle

You can also shuffle the training & testing set separately like so:

const mnist = require('easy-mnist')
                .makeData(60000, 10000, { shuffle: true });

This will not mix the two sets.

About

An easy way to access the MNIST dataset.

Resources

License

Stars

Watchers

Forks

Packages

No packages published