mnist

package module
v0.0.0-...-75bae09 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 8, 2019 License: MIT Imports: 6 Imported by: 0

README

Go MNIST

Installing

go get github.com/sno6/mnist

Getting started

// Read images & labels from local ubyte files.
r, err := mnist.New(&mnist.Files{
    TrainingImagesLoc: imagesLoc,
    TrainingLabelsLoc: labelsLoc,
})

...

// Use the reader to access images & labels.
img := r.TrainingImages.GetImage(1)
label := r.TrainingLabels.GetLabel(1)

...

Example

There's also a working code example here

Documentation

Index

Constants

View Source
const (
	ImageMagic int32 = 2051
	LabelMagic int32 = 2049
)

Variables

This section is empty.

Functions

func ToGrayScale

func ToGrayScale(m [][]uint8) image.Image

Types

type Files

type Files struct {
	TrainingImagesLoc string
	TrainingLabelsLoc string
	TestingImagesLoc  string
	TestingLabelsLoc  string
}

type ImageSet

type ImageSet struct {
	Count      int
	Rows, Cols int
	Images     []uint8
}

func (*ImageSet) GetFlatImage

func (img *ImageSet) GetFlatImage(offset int) []uint8

func (*ImageSet) GetImage

func (img *ImageSet) GetImage(offset int) [][]uint8

type LabelSet

type LabelSet struct {
	Count  int
	Labels []uint8
}

func (*LabelSet) GetLabel

func (l *LabelSet) GetLabel(offset int) uint8

type Reader

type Reader struct {
	TrainingImages, TestingImages *ImageSet
	TrainingLabels, TestingLabels *LabelSet
}

func New

func New(locs *Files) (*Reader, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL