This class encapsulates and loads data in the standard MNIST format. The data resides in two files, an image file and a label file.
More...
#include <mnist.hpp>
|
| MNIST (const char *labelFile, const char *imgFile, int start=0, int len=0) |
| constructor which loads the data from the given file, and can load only part of the data in a file. More...
|
|
| ~MNIST () |
| Destructor. More...
|
|
int | getCount () const |
| returns the number of examples More...
|
|
int | r () const |
| returns the number of rows in each image More...
|
|
int | c () const |
| returns the number of columns in each image More...
|
|
uint8_t | getLabel (int n) const |
| get the label for a given example More...
|
|
uint8_t | getMaxLabel () const |
| get the maximum label value (0 to 9 in the original data but different in other tests) More...
|
|
uint8_t * | getImg (int n) const |
| get the bitmap for a given example More...
|
|
uint8_t | getPix (int n, int x, int y) const |
| get a pixel for a given example More...
|
|
void | dump (int i) const |
| dump the image data to standard out More...
|
|
This class encapsulates and loads data in the standard MNIST format. The data resides in two files, an image file and a label file.
Definition at line 24 of file mnist.hpp.
MNIST::MNIST |
( |
const char * |
labelFile, |
|
|
const char * |
imgFile, |
|
|
int |
start = 0 , |
|
|
int |
len = 0 |
|
) |
| |
|
inline |
constructor which loads the data from the given file, and can load only part of the data in a file.
- Parameters
-
labelFile | the name of the file containing the labels |
imgFile | the name of the file containing the image data |
start | the image number to start loading from |
len | how many images to load (0 means all) |
Definition at line 35 of file mnist.hpp.
returns the number of columns in each image
Definition at line 150 of file mnist.hpp.
void MNIST::dump |
( |
int |
i | ) |
const |
|
inline |
dump the image data to standard out
Definition at line 192 of file mnist.hpp.
int MNIST::getCount |
( |
| ) |
const |
|
inline |
returns the number of examples
Definition at line 135 of file mnist.hpp.
uint8_t* MNIST::getImg |
( |
int |
n | ) |
const |
|
inline |
get the bitmap for a given example
- Returns
- a pointer to the first pixel in the image
Definition at line 175 of file mnist.hpp.
uint8_t MNIST::getLabel |
( |
int |
n | ) |
const |
|
inline |
get the label for a given example
Definition at line 158 of file mnist.hpp.
uint8_t MNIST::getMaxLabel |
( |
| ) |
const |
|
inline |
get the maximum label value (0 to 9 in the original data but different in other tests)
Definition at line 166 of file mnist.hpp.
uint8_t MNIST::getPix |
( |
int |
n, |
|
|
int |
x, |
|
|
int |
y |
|
) |
| const |
|
inline |
get a pixel for a given example
- Returns
- the pixel as a byte
Definition at line 184 of file mnist.hpp.
returns the number of rows in each image
Definition at line 142 of file mnist.hpp.
The documentation for this class was generated from the following file:
- /home/travis/build/jimfinnis/uesmanncpp/mnist.hpp