-
Notifications
You must be signed in to change notification settings - Fork 361
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
classification dataset fix and clean
- Loading branch information
Showing
19 changed files
with
9,541 additions
and
638 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,6 @@ | |
// Artificial Intelligence Techniques SL | ||
// [email protected] | ||
|
||
|
||
#include <iostream> | ||
#include <fstream> | ||
#include <sstream> | ||
|
@@ -25,129 +24,8 @@ int main() | |
{ | ||
try | ||
{ | ||
cout << "OpenNN. ViT Example." << endl; | ||
|
||
// Eigen::Tensor<float, 4> input(1, 1, 1, 1); | ||
// input.setRandom(); | ||
|
||
// Eigen::Tensor<float, 2> kernel(1, 1, 1, 1); | ||
// kernel.setRandom(); | ||
|
||
// Eigen::Tensor<float, 4> output(1, 1, 1, 1); | ||
|
||
// Eigen::array<int, 3> dims; | ||
// output = input.convolve(kernel, dims); | ||
|
||
// std::cout << "input:\n\n" << input << "\n\n"; | ||
// std::cout << "kernel:\n\n" << kernel << "\n\n"; | ||
// std::cout << "output:\n\n" << output << "\n\n"; | ||
|
||
|
||
// const Index samples_number = get_random_index(1, 10); | ||
// const Index inputs_number = get_random_index(1, 10); | ||
// const Index targets_number = get_random_index(1, 10); | ||
// const Index neurons_number = get_random_index(1, 10); | ||
// Index a = 0; | ||
// Index b = 0; | ||
// Tensor<bool, 0> truefalse = a == b; | ||
// cout<<truefalse<<endl; | ||
// throw runtime_error("Stop"); | ||
// srand(static_cast<unsigned>(time(nullptr))); | ||
|
||
// // Data set | ||
|
||
// ImageDataSet image_data_set; | ||
|
||
// image_data_set.set_data_source_path("/home/artelnics/Escritorio/andres_alonso/ViT/dataset/bmp/cifar10_bmp1"); | ||
|
||
// image_data_set.read_bmp(); | ||
|
||
// vector<string> completion_vocabulary = language_data_set.get_completion_vocabulary(); | ||
// vector<string> context_vocabulary = language_data_set.get_context_vocabulary(); | ||
|
||
// // Neural network | ||
|
||
// const Index input_length = image_data_set.get_samples_number(); | ||
// const Index number_labels = image_data_set.get_variables_number(DataSet::VariableUse::Target); | ||
// const Index number_channels = image_data_set.get_channels_number(); | ||
// const Index height = image_data_set.get_image_height(); | ||
// const Index width = image_data_set.get_image_width(); | ||
|
||
// Index number_of_layers = 1; | ||
// Index depth = 64; | ||
// Index perceptron_depth = 128; | ||
// Index heads_number = 4; | ||
|
||
|
||
|
||
// Transformer transformer({ input_length, decoder_length, inputs_dimension, context_dimension, | ||
// depth, perceptron_depth, heads_number, number_of_layers }); | ||
|
||
// transformer.set_model_type_string("TextClassification"); | ||
// transformer.set_dropout_rate(0); | ||
|
||
// cout << "Total number of parameters: " << transformer.get_parameters_number() << endl; | ||
|
||
// transformer.set_input_vocabulary(completion_vocabulary); | ||
// transformer.set_context_vocabulary(context_vocabulary); | ||
|
||
// // Training strategy | ||
|
||
// TrainingStrategy training_strategy(&transformer, &language_data_set); | ||
|
||
// training_strategy.set_loss_method(TrainingStrategy::LossMethod::CROSS_ENTROPY_ERROR_3D); | ||
|
||
// training_strategy.get_loss_index()->set_regularization_method(LossIndex::RegularizationMethod::NoRegularization); | ||
|
||
// training_strategy.set_optimization_method(TrainingStrategy::OptimizationMethod::ADAPTIVE_MOMENT_ESTIMATION); | ||
|
||
// training_strategy.get_adaptive_moment_estimation()->set_custom_learning_rate(depth); | ||
|
||
// training_strategy.get_adaptive_moment_estimation()->set_loss_goal(0.99); | ||
// training_strategy.get_adaptive_moment_estimation()->set_maximum_epochs_number(4000); | ||
// training_strategy.get_adaptive_moment_estimation()->set_maximum_time(237600); | ||
// training_strategy.get_adaptive_moment_estimation()->set_batch_samples_number(64); | ||
|
||
// training_strategy.get_adaptive_moment_estimation()->set_display(true); | ||
// training_strategy.get_adaptive_moment_estimation()->set_display_period(1); | ||
|
||
// TrainingResults training_results = training_strategy.perform_training(); | ||
|
||
// const TestingAnalysis testing_analysis(&transformer, &language_data_set); | ||
|
||
// pair<type, type> transformer_error_accuracy = testing_analysis.test_transformer(); | ||
|
||
// cout << "TESTING ANALYSIS:" << endl; | ||
// cout << "Testing error: " << transformer_error_accuracy.first << endl; | ||
// cout << "Testing accuracy: " << transformer_error_accuracy.second << endl; | ||
|
||
// // // Save results- | ||
|
||
// // transformer.save("/home/artelnics/Escritorio/andres_alonso/ViT/ENtoES_model.xml"); | ||
|
||
// // // Testing analysis | ||
|
||
// // transformer.load("/home/artelnics/Escritorio/andres_alonso/ViT/Weights/ENtoES_model.xml"); | ||
|
||
// // const TestingAnalysis testing_analysis(&transformer, &language_data_set); | ||
|
||
// // pair<type, type> transformer_error_accuracy = testing_analysis.test_transformer(); | ||
|
||
// // cout << "TESTING ANALYSIS:" << endl; | ||
// // cout << "Testing error: " << transformer_error_accuracy.first << endl; | ||
// // cout << "Testing accuracy: " << transformer_error_accuracy.second << endl; | ||
|
||
|
||
// ForwardPropagation forward_propagation(samples_number, &neural_network); | ||
|
||
// neural_network.forward_propagate(batch.get_input_pairs(), forward_propagation, true); | ||
|
||
// Loss index | ||
|
||
// NormalizedSquaredError normalized_squared_error(&neural_network, &data_set); | ||
cout << "OpenNN. Blank." << endl; | ||
|
||
// BackPropagation back_propagation(samples_number, &normalized_squared_error); | ||
// normalized_squared_error.back_propagate(batch, forward_propagation, back_propagation); | ||
|
||
cout << "Bye!" << endl; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.