44 namespace application {
56 namespace applications {
59 autoencoder_filename(
"autoencoder_filename",
"autoencoder.txt"),
60 autoencoder_layers_to_be_removed(
"autoencoder_layers_to_be_removed", 0),
61 softmax_filename(
"softmax_filename",
"softmax.txt"),
62 softmax_save(
"softmax_save", false),
63 softmax_load(
"softmax_load", false)
76 LOG(LINFO) <<
"Properties registered";
94 VGL_MANAGER->initializeGLUT(argc, argv);
97 w2d_input =
new WindowMatrix2D(
"Input matrix", 256, 256, 0, 0);
99 w_prob =
new WindowProbability(
"Probabilty", 128, 256, 320, 0);
101 collector_ptr = std::make_shared < mic::utils::DataCollector<std::string, float> >( );
103 collector_ptr->createContainer(
"training_loss", mic::types::color_rgba(0, 0, 255, 180));
104 collector_ptr->createContainer(
"test_loss", mic::types::color_rgba(0, 255, 0, 180));
107 w_chart =
new WindowCollectorChart<float>(
"MNISTPatchReconstruction", 0, 310, 512, 256);
113 LOG(LTRACE) <<
"MNISTClassificationSoftmaxApplication::initializePropertyDependentVariables";
120 input_target = std::make_shared<mic::types::MatrixXf >(10,1);
125 w_prob->setMatrixPointer1(input_target);
126 w_prob->setMatrixPointer2(decoded_prediction);
136 mnist_encoder =
new mic::encoders::MatrixXfMatrixXfEncoder(patch_size, patch_size);
141 LOG(LINFO) <<
"Loaded the autoencoder network";
150 LOG(LINFO) <<
"The resulting softmax network";
154 LOG(LINFO) <<
"Loaded the softmax network";
170 (*input_image) = (*sample.data());
174 mic::types::MatrixXfPtr encoded_patch =
mnist_encoder->encodeSample(sample.data());
175 mic::types::MatrixXfPtr encoded_label =
label_encoder->encodeSample(sample.label());
181 (*input_target) = (*encoded_label);
196 (*input_image) = (*sample.data());
199 mic::types::MatrixXfPtr encoded_patch =
mnist_encoder->encodeSample(sample.data());
200 mic::types::MatrixXfPtr encoded_label =
label_encoder->encodeSample(sample.label());
227 LOG(LINFO)<<
"Iteration = " << iteration;
mic::utils::DataCollectorPtr< std::string, float > collector_ptr
Data collector.
Class representing a cross-entropy loss function (classification).
mic::configuration::Property< std::string > autoencoder_filename
Property: name of the file to which the original auto-encoder will be loaded from.
bool save(std::string filename_)
Class implementing a simple MNIST patch softmax classification with multi-layer neural net - imported...
MNISTPatchSoftmaxApplication(std::string node_name_="mnist_patch_autoencoder_reconstruction")
BackpropagationNeuralNetwork< float > neural_net
Multi-layer neural network.
mic::types::MatrixXfPtr input_image
Input image/matrix.
WindowProbability * w_prob
Window displaying the probabilities.
void popLayer(size_t number_of_layers_=1)
virtual ~MNISTPatchSoftmaxApplication()
virtual void collectTestStatistics()
virtual bool performLearningStep()
virtual void populateTestStatistics()
mic::configuration::Property< bool > softmax_load
Property: flag denoting whether the nn should be loaded from a file (at the initialization of the tas...
mic::configuration::Property< bool > softmax_save
Property: flag denoting whether the nn should be saved to a file (after every episode end)...
mic::types::MatrixPtr< eT > getPredictions()
mic::types::MatrixXfPtr input_target
Probability.
mic::configuration::Property< std::string > softmax_filename
Property: name of the file with softmax nn.
virtual void initialize(int argc, char *argv[])
void RegisterApplication(void)
Registers application.
eT test(mic::types::MatrixPtr< eT > encoded_batch_, mic::types::MatrixPtr< eT > encoded_targets_)
WindowCollectorChart< float > * w_chart
Window for displaying chart with statistics.
WindowMatrix2D * w2d_input
Window for displaying the input image.
mic::importers::MNISTPatchImporter * training_dataset_importer
Importer responsible for loading training dataset.
eT train(mic::types::MatrixPtr< eT > encoded_batch_, mic::types::MatrixPtr< eT > encoded_targets_, eT learning_rate_, eT decay_=0.0f)
virtual void initializePropertyDependentVariables()
mic::types::MatrixXfPtr decoded_prediction
Probability.
size_t patch_size
Size of the patch - copied from importers.
mic::configuration::Property< size_t > autoencoder_layers_to_be_removed
Property: number of layers to be removed (starting from the last one).
mic::encoders::UIntMatrixXfEncoder * label_encoder
Label 2 matrix encoder (1 hot).
void pushLayer(LayerType *layer_ptr_)
bool load(std::string filename_)
mic::encoders::MatrixXfMatrixXfEncoder * mnist_encoder
MNIST matrix encoder.
mic::importers::MNISTPatchImporter * test_dataset_importer
Importer responsible for loading testing dataset.