This file contains hidden or 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
| ///Stacked Autoencoder 2 layer L1 and L2 | |
| ///Hit <?> to read help menu. | |
| ///Now USE_IND_NOISE switch ON make more realistoc gabor filter like feature on first layer | |
| ///TODO: Not yet show the image representation off each L2 feature projected on a L1 layer image representation | |
| int Pause_cam =0; | |
| #define USE_RASPICAM_INPUT //If you want to use raspicam input data | |
| //#define USE_MNIST_DATABASE// Here read the t10k-images-idx3-ubyte file | |
| //Here use real image from raspicam take random part 10x10 pixel and put in to the autoencoder | |
| //test stacking autoencoder 2 layer 4x input same Layer 1 (L1) filter down to the Layer 2 (L2) |
This file contains hidden or 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
| ///Stacked Autoencoder 2 layer L1 and L2 | |
| ///TODO: Not yet show the image representation off each L2 feature projected on a L1 layer image representation | |
| int Pause_cam =0; | |
| #define USE_RASPICAM_INPUT //If you want to use raspicam input data | |
| //#define USE_MNIST_DATABASE// Here read the t10k-images-idx3-ubyte file | |
| //Here use real image from raspicam take random part 10x10 pixel and put in to the autoencoder | |
| //test stacking autoencoder 2 layer 4x input same Layer 1 (L1) filter down to the Layer 2 (L2) | |
| //L2 input nodes = 4x L1 nodes |
This file contains hidden or 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
| ///Now with fully connected Logistic Regression network Supervised Learning | |
| ///************* Parameters and things regarding fully connected network ************** | |
| int fully_conn_backprop =0; | |
| const int C_fully_hidd_nodes = 200; | |
| const int C_fully_out_nodes = 10; | |
| int fully_hidd_nodes = C_fully_hidd_nodes; | |
| int fully_out_nodes = C_fully_out_nodes; | |
| int drop_out_percent = 50;/// 50% dropout percent hidden nodes during training | |
| int verification = 0; | |
| float Error_level=0.0f; |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h>// exit(0); | |
| float abs_value(float signed_value) | |
| { | |
| float abs_v; | |
| abs_v = signed_value; | |
| if(abs_v < 0) | |
| { | |
| abs_v = -abs_v; |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h>// exit(0); | |
| float abs_value(float signed_value) | |
| { | |
| float abs_v; | |
| abs_v = signed_value; | |
| if(abs_v < 0) | |
| { | |
| abs_v = -abs_v; |
This file contains hidden or 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
| #include <stdio.h> | |
| #include <stdlib.h>// exit(0); | |
| float abs_value(float signed_value) | |
| { | |
| float abs_v; | |
| abs_v = signed_value; | |
| if(abs_v < 0) | |
| { | |
| abs_v = -abs_v; |
This file contains hidden or 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
| /// Add gamma parameter and use dice and network probability for make action decisions UP/DOWN. | |
| /// Example of Reinforced Machine Learning attached on a simple Pinball game | |
| /// The enviroment (enviroment = data feedback) for the Agient (Agient = machine learning system) | |
| /// is the raw pixels 50x50 pixels (2500 input nodes) and 200 hidden nodes on 100 frames | |
| /// So the input to hidden weights is 50x50x100x200 x4 bytes (float) = is 200Mbytes huges but it work anyway!! | |
| ///Enhancment to do in future. | |
| ///TODO: Add some layers of Convolutions (with unsupervised Learning for learning feature patches) will probably enhance preformance. | |
| ///TODO: Maybe add bias weigth is a good idee to enhance preformance or stability during training. | |
| ///#define USE_PRINT_OUTPUT_NODE_VALUE ///Uncomment this to see print out of output node value. Only used for evaluation | |
| #include <opencv2/highgui/highgui.hpp> // OpenCV window I/O |
This file contains hidden or 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
| /// Change some settings 2017-10-25 | |
| /// Only dependancy is OpenCV C++ library need to be installed | |
| /// Example of Reinforced Machine Learning attached on a simple Pinball game | |
| /// The enviroment (enviroment = data feedback) for the Agient (Agient = machine learning system) | |
| /// is the raw pixels 50x50 pixels (2500 input nodes) and 200 hidden nodes on 100 frames | |
| /// So the input to hidden weights is 50x50x100x200 x4 bytes (float) = is 200Mbytes huges but it work anyway!! | |
| ///Enhancment to do in future. | |
| ///TODO: Add some layers of Convolutions (with unsupervised Learning for learning feature patches) will probably enhance preformance. | |
| ///TODO: Maybe add bias weigth is a good idee to enhance preformance or stability during training. | |
| #include <opencv2/highgui/highgui.hpp> // OpenCV window I/O |
This file contains hidden or 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 is a code made to run 3-phase PWM drive stage with 6-transistors, in other words 3 half bridge transistors with an Arduino UNO | |
| //This setup is made with User settings of DEAD TIME. So here the the dead time can be adjusted by user. const int dead_time = 10;//10 = 0.625 us | |
| //The PWM work here with fix frequancy of 31.25kHz (Other settings may not work proper when use all 3 TIMERS, if you want more flexibilty use Arduino MEGA 2560 or some other plattform) | |
| //Olle Welin [email protected] | |
| // TL Transistor Low side of half bridge pair | |
| // TH Transistor High side of half bridge pair | |
| // PWM assignement at Arduino UNO is by following: | |
| //~6 TL, PH0, TMR0, pwm_ph0 data value |
This file contains hidden or 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 is a code made to run 3-phase PWM drive stage with 6-transistors, in other words 3 half bridge transistors with an Arduino UNO | |
| //This setup is made with User settings of DEAD TIME. So here the the dead time can be adjusted by user. const int dead_time = 10;//10 = 0.625 us | |
| //The PWM work here with fix frequancy of 31.25kHz (Other settings may not work proper when use all 3 TIMERS, if you want more flexibilty use Arduino MEGA 2560 or some other plattform) | |
| //Olle Welin [email protected] | |
| // TL Transistor Low side of half bridge pair | |
| // TH Transistor High side of half bridge pair | |
| // PWM assignement at Arduino UNO is by following: | |
| //~6 TL, PH0, TMR0, pwm_ph0 data value |