The MNIST database is a dataset of handwritten digits. It has 60,000 training samples, and 10,000 test samples. Each image is represented by 28x28 pixels, each containing a value 0 - 255 with its grayscale value. For more information and to download the database, see .
Package provides a simple interface to parse and use the MNIST database. It can automatically download the database files (and cache) or you can download the database files manually to be easly loaded with the LoadData function. Also the package supports convertation of base data structures to [gonum](https://www.gonum.org/) matrices.
import github.com/r2dtools/mnist/loader
train, test, err := loader.LoadData("")
if err != nil {
panic(err)
}
trainSlice := train.Slice(0, 1000)
trainImages := train.Images
trainLabels := train.Labels
testImages := test.Images
testLabels := test.Labels
import github.com/r2dtools/mnist/loader
train, test, err := loader.LoadData("/working/directory")
if err != nil {
panic(err)
}
....
import (
github.com/r2dtools/mnist/dense
github.com/r2dtools/mnist/loader
)
train, test, err := loader.LoadData("")
if err != nil {
panic(err)
}
images := dense.NewImageDenses(train.Images, 1, loader.ImageWidth*loader.ImageHeight) // convert images data to a slice of gonum matrices with dimension 1x784
labels := dense.NewLabelVecDense(train.Labels)
normalizedImages := dense.NewNormalizedImageDenses(train.Images, 1, loader.ImageWidth*loader.ImageHeight, 255) // convert images data to a slice of gonum matrices with dimension 1x784. Devide all element by 255
....