Code Monkey home page Code Monkey logo

mnist's Introduction

MNIST Golang

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.

Automatically download and parse MNIST database files

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

Use already downloaded database files

import github.com/r2dtools/mnist/loader

train, test, err := loader.LoadData("/working/directory")
if err != nil {
    panic(err)
}

....

Convert base data structures to gonum Matrix

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

....

mnist's People

Contributors

alexsibtihon avatar r2dtools avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.