Deep Neural Network for MNIST Handwriting Recognition  1.0
Deep Neural Network for MNIST Handwriting Recognition
Functions
mnist-utils.c File Reference

Utitlies for handling the MNIST data set files. More...

#include <stdlib.h>
#include <string.h>
#include "mnist-utils.h"

Functions

uint32_t flipBytes (uint32_t n)
 
void readImageFileHeader (FILE *imageFile, MNIST_ImageFileHeader *ifh)
 
void readLabelFileHeader (FILE *imageFile, MNIST_LabelFileHeader *lfh)
 
FILE * openMNISTImageFile (char *fileName)
 Returns a file pointer to the MNIST image file. More...
 
FILE * openMNISTLabelFile (char *fileName)
 Returns a file pointer to the MNIST label file. More...
 
MNIST_Image getImage (FILE *imageFile)
 Returns the next image in given MNIST image file. More...
 
MNIST_Image getImageByPosition (FILE *imageFile, int position)
 
MNIST_Label getLabel (FILE *labelFile)
 Returns the next label in given MNIST label file. More...
 
MNIST_Label getLabelByPosition (FILE *labelFile, int position)
 
VectorgetVectorFromImage (MNIST_Image *img)
 Returns a Vector holding the image pixels of a given MNIST image. More...
 

Detailed Description

Utitlies for handling the MNIST data set files.

See also
http://yann.lecun.com/exdb/mnist/
Author
Matt Lind
Date
July 2015

Function Documentation

uint32_t flipBytes ( uint32_t  n)

Reverse byte order in 32bit numbers MNIST files contain all numbers in reversed byte order, and hence must be reversed before using

MNIST_Image getImage ( FILE *  imageFile)

Returns the next image in given MNIST image file.

Returns the next image in the given MNIST image file

MNIST_Image getImageByPosition ( FILE *  imageFile,
int  position 
)

Returns the image located at the specified position in the given MNIST image file

MNIST_Label getLabel ( FILE *  labelFile)

Returns the next label in given MNIST label file.

Returns the next label in the given MNIST label file

MNIST_Label getLabelByPosition ( FILE *  labelFile,
int  position 
)

Returns the label located at the specified position in the given MNIST label file

Vector* getVectorFromImage ( MNIST_Image img)

Returns a Vector holding the image pixels of a given MNIST image.

Parameters
imgA pointer to a MNIST image
FILE* openMNISTImageFile ( char *  fileName)

Returns a file pointer to the MNIST image file.

Opens the file and moves the read pointer to the position of the 1st image

See also
http://yann.lecun.com/exdb/mnist/ for more details on the file definition
FILE* openMNISTLabelFile ( char *  fileName)

Returns a file pointer to the MNIST label file.

Opens the file and moves the read pointer to the position of the 1st label

See also
http://yann.lecun.com/exdb/mnist/ for more details on the file definition
void readImageFileHeader ( FILE *  imageFile,
MNIST_ImageFileHeader ifh 
)

Read MNIST image file header

See also
http://yann.lecun.com/exdb/mnist/ for definition details
void readLabelFileHeader ( FILE *  imageFile,
MNIST_LabelFileHeader lfh 
)

Read MNIST label file header

See also
http://yann.lecun.com/exdb/mnist/ for definition details