MachineIntelligenceCore:Algorithms
|
Class responsible for importing CIFAR images. Returns a batch of Tensors. More...
#include <CIFARImporter.hpp>
Public Member Functions | |
CIFARImporter (std::string node_name_="cifar_importer", std::string data_filename_="", int min_sample_=-1, int max_sample_=-1) | |
virtual | ~CIFARImporter () |
void | setDataFilename (std::string data_filename_) |
bool | importData () |
virtual void | initializePropertyDependentVariables () |
![]() | |
Importer (std::string node_name_, size_t batch_size_=1) | |
virtual | ~Importer () |
![]() | |
Batch (size_t batch_size_=1) | |
Batch (const mic::types::Batch< mic::types::Tensor< eT >, unsigned int > &batch_) | |
mic::types::Batch < mic::types::Tensor< eT > , unsigned int > & | operator= (const mic::types::Batch< mic::types::Tensor< eT >, unsigned int > &batch_) |
virtual | ~Batch () |
std::vector< std::shared_ptr < mic::types::Tensor< eT > > > & | data () |
Returns sample data. More... | |
std::shared_ptr < mic::types::Tensor< eT > > | 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::Tensor< eT > , unsigned int > | getRandomBatch () |
mic::types::Batch < mic::types::Tensor< eT > , unsigned int > | getNextBatch () |
mic::types::Batch < mic::types::Tensor< eT > , unsigned int > | getBatch (std::vector< size_t > indices_) |
mic::types::Batch < mic::types::Tensor< eT > , unsigned int > | getBatchDirect (std::vector< size_t > indices_) |
bool | isLastBatch () |
mic::types::Sample < mic::types::Tensor< eT > , unsigned int > | getRandomSample () |
mic::types::Sample < mic::types::Tensor< eT > , unsigned int > | getNextSample () |
mic::types::Sample < mic::types::Tensor< eT > , unsigned int > | getSample (size_t index_) |
mic::types::Sample < mic::types::Tensor< eT > , unsigned int > | getSampleDirect (size_t index_) |
void | setNextSampleIndex (size_t index_=0) |
bool | isLastSample () |
virtual void | add (mic::types::Sample< mic::types::Tensor< eT >, unsigned int > sample_) |
virtual void | add (std::shared_ptr< mic::types::Tensor< eT > > data_, std::shared_ptr< unsigned int > label_, size_t index_) |
virtual void | add (std::shared_ptr< mic::types::Tensor< eT > > data_, std::shared_ptr< unsigned int > label_) |
void | countClasses () |
size_t | classes () |
Private Attributes | |
size_t | image_height |
size_t | image_width |
size_t | image_depth |
mic::configuration::Property < std::string > | data_filename |
mic::configuration::Property< int > | min_sample |
mic::configuration::Property< int > | max_sample |
Additional Inherited Members | |
![]() | |
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::Tensor< eT > > > | 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 |
Class responsible for importing CIFAR images. Returns a batch of Tensors.
Definition at line 41 of file CIFARImporter.hpp.
|
inline |
Constructor. Sets CIFAR image default properties. Registers properties.
node_name_ | Name of the node in configuration file. |
data_filename_ | File(s) (with path) containing images. If data is supposed to be loaded from more than one files, they should be separated by a semicolon (;). |
min_sample_ | Index of first sample to be added to batch (samples < min_sample_ will be skipped) (DEFAULT=-1 - all samples). |
max_sample_ | Index of last sample to be added to batch (samples > max_sample_ will be skipped) (DEFAULT=-1 - all samples). |
Definition at line 50 of file CIFARImporter.hpp.
References mic::importers::CIFARImporter< eT >::data_filename, mic::importers::CIFARImporter< eT >::image_depth, mic::importers::CIFARImporter< eT >::image_height, mic::importers::CIFARImporter< eT >::image_width, mic::importers::CIFARImporter< eT >::max_sample, and mic::importers::CIFARImporter< eT >::min_sample.
|
inlinevirtual |
Virtual destructor. Empty.
Definition at line 72 of file CIFARImporter.hpp.
|
inlinevirtual |
Method responsible for importing/loading the CIFAR dataset.
Implements mic::importers::Importer< mic::types::Tensor< eT >, unsigned int >.
Definition at line 86 of file CIFARImporter.hpp.
References mic::types::Batch< mic::types::Tensor< eT >, unsigned int >::countClasses(), mic::types::Batch< mic::types::Tensor< eT >, unsigned int >::data(), mic::importers::CIFARImporter< eT >::data_filename, mic::importers::CIFARImporter< eT >::image_depth, mic::importers::CIFARImporter< eT >::image_height, mic::importers::CIFARImporter< eT >::image_width, MAKE_TENSOR_PTR, mic::importers::CIFARImporter< eT >::max_sample, mic::importers::CIFARImporter< eT >::min_sample, mic::types::Batch< mic::types::Tensor< eT >, unsigned int >::sample_data, mic::types::Batch< mic::types::Tensor< eT >, unsigned int >::sample_indices, and mic::types::Batch< mic::types::Tensor< eT >, unsigned int >::sample_labels.
|
inlinevirtual |
Method responsible for initialization of all variables that are property-dependent - here not required, yet empty.
Definition at line 199 of file CIFARImporter.hpp.
|
inline |
Set name and patch of the file/files containing CIFAR images.
data_filename_ | File (with path) containing CIFAR images. If data is supposed to be loaded from more than one files, they should be separated by a semicolon (;). |
Definition at line 78 of file CIFARImporter.hpp.
References mic::importers::CIFARImporter< eT >::data_filename.
|
private |
Property: directory/Name of file containing images (binary files).
Definition at line 230 of file CIFARImporter.hpp.
Referenced by mic::importers::CIFARImporter< eT >::CIFARImporter(), mic::importers::CIFARImporter< eT >::importData(), and mic::importers::CIFARImporter< eT >::setDataFilename().
|
private |
Depth of CIFAR image (number of channels).
Definition at line 224 of file CIFARImporter.hpp.
Referenced by mic::importers::CIFARImporter< eT >::CIFARImporter(), and mic::importers::CIFARImporter< eT >::importData().
|
private |
Height of CIFAR image.
Definition at line 214 of file CIFARImporter.hpp.
Referenced by mic::importers::CIFARImporter< eT >::CIFARImporter(), and mic::importers::CIFARImporter< eT >::importData().
|
private |
Width of CIFAR image.
Definition at line 219 of file CIFARImporter.hpp.
Referenced by mic::importers::CIFARImporter< eT >::CIFARImporter(), and mic::importers::CIFARImporter< eT >::importData().
|
private |
Property: index of the last sample to be added to batch (samples > max_sample_ will be skipped) (DEFAULT=-1 - all samples).
Definition at line 240 of file CIFARImporter.hpp.
Referenced by mic::importers::CIFARImporter< eT >::CIFARImporter(), and mic::importers::CIFARImporter< eT >::importData().
|
private |
Property: index of the first sample to be added to batch (samples < min_sample_ will be skipped) (DEFAULT=-1 - all samples).
Definition at line 235 of file CIFARImporter.hpp.
Referenced by mic::importers::CIFARImporter< eT >::CIFARImporter(), and mic::importers::CIFARImporter< eT >::importData().