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
///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
///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
///Now USE_IND_NOISE switch ON make more realistoc gabor filter like feature | |
/// Fix Bugg replace hidden_node[j] and output_node[i] with Bias_level | |
// change_weight_in2hid[j] = (LearningRate/2) * hidden_node[j] * hid_node_delta[j] + Momentum * change_weight_in2hid[j]; | |
// change_weight_hid2out[i] = (LearningRate/2) * output_node[i] * delta_pixel + Momentum * change_weight_hid2out[i]; | |
///#define USE_LIM_BIAS// | |
//Here use real image from raspicam take random part 10x10 pixel and put in to the autoencoder | |
const int cam_h = 240; |
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 also Add bias nodes showed in the last 2 patches | |
const float Bias_level = 1.0f; | |
const float Bias_w_n_range = -1.0f; | |
const float Bias_w_p_range = 1.0f; | |
const float change_bias_weight_range = 0.2f; | |
//Add visualize hidden nodes | |
//Add so you can save weight by press <S> | |
//Autoencoder learning test with raspicam |
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 visualize hidden nodes | |
//Add so you can save weight by press <S> | |
//Autoencoder learning test with raspicam | |
//press <Y> at start It's tested with dataset from | |
/// t10k-images-idx3-ubyte | |
/// http://yann.lecun.com/exdb/mnist/ | |
//If you comment out USE_MNIST_DATABASE switch then simpler pattern used from a picture https://blog.webkid.io/datasets-for-machine-learning/ | |
//0..9 28x28 pixel digits pattern mnist.png filname 289x289 orginal | |
//orginal image taken from |
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
//Test2 improved and also show (visualize) the noise input stimulu | |
//Autoencoder learning test with raspicam | |
//press <Y> at start It's tested with 0..9 28x28 pixel digits pattern mnist.png filname 289x289 orginal | |
//orginal image taken from | |
// https://blog.webkid.io/datasets-for-machine-learning/ | |
//#define USE_RASPICAM_INPUT //If you want to use raspicam input data | |
#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
//Autoencoder learning test with raspicam | |
//press <Y> at start It's tested with 0..9 28x28 pixel digits pattern mnist.png filname 289x289 orginal | |
//orginal image taken from | |
// https://blog.webkid.io/datasets-for-machine-learning/ | |
//#define USE_RASPICAM_INPUT //If you want to use raspicam input data | |
#include <opencv2/highgui/highgui.hpp> // OpenCV window I/O | |
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur |
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 code take some posXXX.jpg and verXXX.jpg files in program root dir and tranform images to a folder with name \positive_data\posXXX.jpg verXXX.jpg | |
//#include <stdio.h> | |
//#include <unistd.h> | |
//#include <ctime> | |
//#include <iostream> | |
//#include <raspicam/raspicam_cv.h> | |
#include <opencv2/highgui/highgui.hpp> // OpenCV window I/O | |
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur |
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
//2017-05-11 fix bugg index was wrong before m32_conv0 = convolute_mat2(&Feature0Kernel[31][0], FE0KSIZESQR, FE0KSIZESQR, m1_0_padded, int (m1_0_padded.cols));// Make a convolution of the image | |
//2017-05-05 32x32x32 feature stright connection | |
//2017-05-05 FIX so kernel update weight direct after each pixel step (before there was a sum up all steps togheter dont work prorper). So now the kerenle patches traingin much much faster and better | |
//the kernels feature now adapt and look's much more like it correspond to the traingin images. | |
//Add dropout on fully connected HiddenNodes prevent overtraning | |
//2017-01-17 fix bugg in make_SumChangeFeature0Weights replace c_m1 with m1_conv0 | |
//Ask of loading any reruned training turn | |
//Rerun fully connected weights (10 times) and lock kernel layer 0 after (2) rerun lock kernel layer 1 after (4) reruns | |
//Show all kernels in 3 windows | |
//In this example 6 output nodes and explaned training images set in start of program. |