Deep Neural Network for MNIST Handwriting Recognition  1.0
Deep Neural Network for MNIST Handwriting Recognition
Data Structures | Macros | Typedefs | Functions
mnist-utils.h File Reference

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

#include <stdint.h>
#include <stdio.h>

Go to the source code of this file.

Data Structures

struct  Vector
 Variably-sized data structure defining a vector with "count" doubles. More...
 
struct  MNIST_Image
 Data block defining a MNIST image. More...
 
struct  MNIST_ImageFileHeader
 Data block defining a MNIST image file header. More...
 
struct  MNIST_LabelFileHeader
 Data block defining a MNIST label file header. More...
 

Macros

#define MNIST_TRAINING_SET_IMAGE_FILE_NAME   "./data/train-images-idx3-ubyte"
 
#define MNIST_TRAINING_SET_LABEL_FILE_NAME   "./data/train-labels-idx1-ubyte"
 
#define MNIST_TESTING_SET_IMAGE_FILE_NAME   "./data/t10k-images-idx3-ubyte"
 
#define MNIST_TESTING_SET_LABEL_FILE_NAME   "./data/t10k-labels-idx1-ubyte"
 
#define MNIST_MAX_TRAINING_IMAGES   60000
 Define number datasets (images+labels) in the TRAIN file/s. More...
 
#define MNIST_MAX_TESTING_IMAGES   10000
 Define number datasets (images+labels) in the TEST file/s. More...
 
#define MNIST_IMG_WIDTH   28
 
#define MNIST_IMG_HEIGHT   28
 

Typedefs

typedef struct MNIST_ImageFileHeader MNIST_ImageFileHeader
 
typedef struct MNIST_LabelFileHeader MNIST_LabelFileHeader
 
typedef struct MNIST_Image MNIST_Image
 
typedef uint8_t MNIST_Label
 
typedef struct Vector Vector
 

Functions

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

Macro Definition Documentation

#define MNIST_IMG_HEIGHT   28
#define MNIST_IMG_WIDTH   28
#define MNIST_MAX_TESTING_IMAGES   10000

Define number datasets (images+labels) in the TEST file/s.

#define MNIST_MAX_TRAINING_IMAGES   60000

Define number datasets (images+labels) in the TRAIN file/s.

#define MNIST_TESTING_SET_IMAGE_FILE_NAME   "./data/t10k-images-idx3-ubyte"
#define MNIST_TESTING_SET_LABEL_FILE_NAME   "./data/t10k-labels-idx1-ubyte"
#define MNIST_TRAINING_SET_IMAGE_FILE_NAME   "./data/train-images-idx3-ubyte"
#define MNIST_TRAINING_SET_LABEL_FILE_NAME   "./data/train-labels-idx1-ubyte"

Typedef Documentation

typedef struct MNIST_Image MNIST_Image
typedef uint8_t MNIST_Label
typedef struct Vector Vector

Function Documentation

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