MachineIntelligenceCore:Algorithms
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
mic::importers::MNISTPatchImporter Class Reference

Importer responsible for importing/loading MNIST images with labels. More...

#include <MNISTPatchImporter.hpp>

Inheritance diagram for mic::importers::MNISTPatchImporter:
Collaboration diagram for mic::importers::MNISTPatchImporter:

Public Member Functions

 MNISTPatchImporter (std::string node_name_="mnist_patch_importer")
 
virtual ~MNISTPatchImporter ()
 
bool importData ()
 
void setDataFilename (std::string data_filename_)
 
void setLabelsFilename (std::string labels_filename_)
 
virtual void initializePropertyDependentVariables ()
 
size_t getPatchSize ()
 
- Public Member Functions inherited from mic::importers::Importer< mic::types::MatrixXf, unsigned int >
 Importer (std::string node_name_, size_t batch_size_=1)
 
virtual ~Importer ()
 
- Public Member Functions inherited from mic::types::Batch< mic::types::MatrixXf, unsigned int >
 Batch (size_t batch_size_=1)
 
 Batch (const mic::types::Batch< mic::types::MatrixXf, unsigned int > &batch_)
 
mic::types::Batch
< mic::types::MatrixXf,
unsigned int > & 
operator= (const mic::types::Batch< mic::types::MatrixXf, unsigned int > &batch_)
 
virtual ~Batch ()
 
std::vector< std::shared_ptr
< mic::types::MatrixXf > > & 
data ()
 Returns sample data. More...
 
std::shared_ptr
< mic::types::MatrixXf
data (size_t index_)
 
std::vector< std::shared_ptr
< unsigned int > > & 
labels ()
 Returns sample labels. More...
 
std::shared_ptr< unsigned int > labels (size_t index_)
 
std::vector< size_t > & indices ()
 Returns sample numbers (sample "positions" in original dataset). More...
 
std::vector< size_t > indices (size_t index_)
 
size_t size ()
 
void setBatchSize (size_t batch_size_)
 
size_t getBatchSize ()
 
mic::types::Batch
< mic::types::MatrixXf,
unsigned int > 
getRandomBatch ()
 
mic::types::Batch
< mic::types::MatrixXf,
unsigned int > 
getNextBatch ()
 
mic::types::Batch
< mic::types::MatrixXf,
unsigned int > 
getBatch (std::vector< size_t > indices_)
 
mic::types::Batch
< mic::types::MatrixXf,
unsigned int > 
getBatchDirect (std::vector< size_t > indices_)
 
bool isLastBatch ()
 
mic::types::Sample
< mic::types::MatrixXf,
unsigned int > 
getRandomSample ()
 
mic::types::Sample
< mic::types::MatrixXf,
unsigned int > 
getNextSample ()
 
mic::types::Sample
< mic::types::MatrixXf,
unsigned int > 
getSample (size_t index_)
 
mic::types::Sample
< mic::types::MatrixXf,
unsigned int > 
getSampleDirect (size_t index_)
 
void setNextSampleIndex (size_t index_=0)
 
bool isLastSample ()
 
virtual void add (mic::types::Sample< mic::types::MatrixXf, unsigned int > sample_)
 
virtual void add (std::shared_ptr< mic::types::MatrixXf > data_, std::shared_ptr< unsigned int > label_, size_t index_)
 
virtual void add (std::shared_ptr< mic::types::MatrixXf > data_, std::shared_ptr< unsigned int > label_)
 
void countClasses ()
 
size_t classes ()
 

Private Attributes

size_t image_width
 
size_t image_height
 
mic::configuration::Property
< std::string > 
data_filename
 
mic::configuration::Property
< std::string > 
labels_filename
 
mic::configuration::Property
< size_t > 
patch_size
 
mic::configuration::Property< int > samples_limit
 

Additional Inherited Members

- Protected Attributes inherited from mic::types::Batch< mic::types::MatrixXf, unsigned int >
size_t next_sample_index
 
size_t batch_size
 
std::random_device rd
 
std::mt19937_64 rng_mt19937_64
 
std::vector< std::shared_ptr
< mic::types::MatrixXf > > 
sample_data
 Stores the data. More...
 
std::vector< std::shared_ptr
< unsigned int > > 
sample_labels
 Stores labels. More...
 
std::vector< size_t > sample_indices
 Stores sample indices (sample "positions" in original dataset). More...
 
size_t number_of_classes
 

Detailed Description

Importer responsible for importing/loading MNIST images with labels.

Author
tkornuta

Definition at line 36 of file MNISTPatchImporter.hpp.

Constructor & Destructor Documentation

mic::importers::MNISTPatchImporter::MNISTPatchImporter ( std::string  node_name_ = "mnist_patch_importer")

Constructor. Sets MNIST image default properties. Registers properties.

Parameters
node_name_Name of the node in configuration file.

Definition at line 32 of file MNISTPatchImporter.cpp.

References data_filename, image_height, image_width, labels_filename, patch_size, and samples_limit.

virtual mic::importers::MNISTPatchImporter::~MNISTPatchImporter ( )
inlinevirtual

Virtual destructor. Empty.

Definition at line 47 of file MNISTPatchImporter.hpp.

Member Function Documentation

size_t mic::importers::MNISTPatchImporter::getPatchSize ( )
inline

Returns the patch size.

Definition at line 79 of file MNISTPatchImporter.hpp.

References patch_size.

virtual void mic::importers::MNISTPatchImporter::initializePropertyDependentVariables ( )
inlinevirtual

Method responsible for initialization of all variables that are property-dependent - here not required, yet empty.

Definition at line 74 of file MNISTPatchImporter.hpp.

void mic::importers::MNISTPatchImporter::setDataFilename ( std::string  data_filename_)
inline

Sets data filename (with path). DEPRICATED (should be used only for testing purposes).

Parameters
data_filename_Path and filename

Definition at line 59 of file MNISTPatchImporter.hpp.

References data_filename.

void mic::importers::MNISTPatchImporter::setLabelsFilename ( std::string  labels_filename_)
inline

Sets labels filename (with path). DEPRICATED (should be used only for testing purposes).

Parameters
labels_filename_Path and filename

Definition at line 67 of file MNISTPatchImporter.hpp.

References labels_filename.

Member Data Documentation

mic::configuration::Property<std::string> mic::importers::MNISTPatchImporter::data_filename
private

Property: directory/Name of file containing images (binary datafile).

Definition at line 95 of file MNISTPatchImporter.hpp.

Referenced by importData(), MNISTPatchImporter(), and setDataFilename().

size_t mic::importers::MNISTPatchImporter::image_height
private

Height of MNIST image.

Definition at line 90 of file MNISTPatchImporter.hpp.

Referenced by importData(), and MNISTPatchImporter().

size_t mic::importers::MNISTPatchImporter::image_width
private

Width of MNIST image.

Definition at line 85 of file MNISTPatchImporter.hpp.

Referenced by importData(), and MNISTPatchImporter().

mic::configuration::Property<std::string> mic::importers::MNISTPatchImporter::labels_filename
private

Property: directory/Name of file containing labels.

Definition at line 100 of file MNISTPatchImporter.hpp.

Referenced by importData(), MNISTPatchImporter(), and setLabelsFilename().

mic::configuration::Property<size_t> mic::importers::MNISTPatchImporter::patch_size
private

Property: patch size (width & height).

Definition at line 105 of file MNISTPatchImporter.hpp.

Referenced by getPatchSize(), importData(), and MNISTPatchImporter().

mic::configuration::Property<int> mic::importers::MNISTPatchImporter::samples_limit
private

Property: maximum number of samples (limitation, from 1 to 60000). If <=0 then there is no limitation.

Definition at line 110 of file MNISTPatchImporter.hpp.

Referenced by importData(), and MNISTPatchImporter().


The documentation for this class was generated from the following files: