Skip to content

Latest commit

 

History

History
54 lines (36 loc) · 768 Bytes

README.md

File metadata and controls

54 lines (36 loc) · 768 Bytes

mnistidx

Mnistidx module provides api to work with mnist databases.

Usage

package main

import (
	"os"
)

func main() {
	imagesFile, err := os.Open("filepath/to/images/database/file")

	if err != nil {
		panic(err)
	}

	labelsFile, err := os.Open("filepath/to/labels/database/file")

	if err != nil {
		panic(err)
	}

	i, err := mnistidx.NewIDX(imagesFile, labelsFile)

	if err != nil {
		panic(err)
	}

	buf := make([]byte, i.ImageBufSize())

	for {
		l, err := i.Read(buf)

		if err == io.EOF {
			break
		}

		// buf contains image
		// l represent current label
	}
}

Tests

If you run tests mnist databases automatically downloaded to ~/.mnistdb directory

Info

For additional info look at mnistdb