MNIST-3LNN  1.0
A simple 3-layer neural network to recognize handwritten single digit numbers from the MNIST image files.
Data Structures | Macros | Typedefs | Functions
mnist-utils.h File Reference

Utitlies for handling the MNIST files. More...

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

Go to the source code of this file.

Data Structures

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"
 MNIST image training file in the data folder. More...
 
#define MNIST_TRAINING_SET_LABEL_FILE_NAME   "data/train-labels-idx1-ubyte"
 MNIST label training file in the data folder. More...
 
#define MNIST_TESTING_SET_IMAGE_FILE_NAME   "data/t10k-images-idx3-ubyte"
 MNIST image testing file in the data folder. More...
 
#define MNIST_TESTING_SET_LABEL_FILE_NAME   "data/t10k-labels-idx1-ubyte"
 MNIST label testing file in the data folder. More...
 
#define MNIST_MAX_TRAINING_IMAGES   60000
 number of images+labels in the TRAIN file/s More...
 
#define MNIST_MAX_TESTING_IMAGES   10000
 number of images+labels in the TEST file/s More...
 
#define MNIST_IMG_WIDTH   28
 image width in pixel More...
 
#define MNIST_IMG_HEIGHT   28
 image height in pixel More...
 

Typedefs

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

Functions

FILE * openMNISTImageFile (char *fileName)
 Read MNIST IMAGE file header. More...
 
FILE * openMNISTLabelFile (char *fileName)
 Read MNIST label file header. More...
 
MNIST_Image getImage (FILE *imageFile)
 Returns the next image in given MNIST image file. More...
 
MNIST_Label getLabel (FILE *labelFile)
 Returns the next label in given MNIST label file. More...
 
int getStandardDigitPixel (int num, int pixelId)
 

Detailed Description

Utitlies for handling the MNIST files.

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

Definition in file mnist-utils.h.

Macro Definition Documentation

#define MNIST_IMG_HEIGHT   28

image height in pixel

Definition at line 24 of file mnist-utils.h.

#define MNIST_IMG_WIDTH   28

image width in pixel

Definition at line 23 of file mnist-utils.h.

#define MNIST_MAX_TESTING_IMAGES   10000

number of images+labels in the TEST file/s

Definition at line 22 of file mnist-utils.h.

#define MNIST_MAX_TRAINING_IMAGES   60000

number of images+labels in the TRAIN file/s

Definition at line 21 of file mnist-utils.h.

#define MNIST_TESTING_SET_IMAGE_FILE_NAME   "data/t10k-images-idx3-ubyte"

MNIST image testing file in the data folder.

Definition at line 16 of file mnist-utils.h.

#define MNIST_TESTING_SET_LABEL_FILE_NAME   "data/t10k-labels-idx1-ubyte"

MNIST label testing file in the data folder.

Definition at line 17 of file mnist-utils.h.

#define MNIST_TRAINING_SET_IMAGE_FILE_NAME   "data/train-images-idx3-ubyte"

MNIST image training file in the data folder.

Definition at line 13 of file mnist-utils.h.

#define MNIST_TRAINING_SET_LABEL_FILE_NAME   "data/train-labels-idx1-ubyte"

MNIST label training file in the data folder.

Definition at line 14 of file mnist-utils.h.

Typedef Documentation

typedef struct MNIST_Image MNIST_Image

Definition at line 31 of file mnist-utils.h.

Definition at line 28 of file mnist-utils.h.

typedef uint8_t MNIST_Label

Definition at line 32 of file mnist-utils.h.

Definition at line 29 of file mnist-utils.h.

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

Definition at line 139 of file mnist-utils.c.

MNIST_Label getLabel ( FILE *  labelFile)

Returns the next label in given MNIST label file.

Returns the next label in the given MNIST label file

Definition at line 159 of file mnist-utils.c.

int getStandardDigitPixel ( int  num,
int  pixelId 
)

Definition at line 178 of file mnist-utils.c.

FILE* openMNISTImageFile ( char *  fileName)

Read MNIST IMAGE file header.

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

Open MNIST image file and read header info by reading the header info, the read pointer is moved to the position of the 1st IMAGE

Definition at line 93 of file mnist-utils.c.

FILE* openMNISTLabelFile ( char *  fileName)

Read MNIST label file header.

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

Open MNIST label file and read header info by reading the header info, the read pointer is moved to the position of the 1st LABEL

Definition at line 117 of file mnist-utils.c.