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
| ##################################### | |
| cmake_minimum_required (VERSION 2.8) | |
| project (raspicam_test) | |
| set(CMAKE_MODULE_PATH "/usr/local/lib/cmake/${CMAKE_MODULE_PATH}") | |
| find_package(raspicam REQUIRED) | |
| find_package(OpenCV) | |
| IF ( OpenCV_FOUND AND raspicam_CV_FOUND) | |
| MESSAGE(STATUS "COMPILING OPENCV TESTS") | |
| #SET_SOURCE_FILES_PROPERTIES( gpio_test.c PROPERTIES LANGUAGE CXX ) |
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
| //Fix bugg 2017-05-10 (....C2M_W....) before (C2M_H,C2M_H... | |
| //Mat pol_c_m1_unpad(C2M_H,C2M_W,CV_32F);//After second pooling befor padding | |
| //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. | |
| //File: NN18.cpp | |
| //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. |
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-07 find bugg Mat pol_c_m1_unpad(C2M_H,C2M_W,CV_32F); was before bug fix ..C2M_H,C2M_H.. | |
| //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 |
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. |
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
| //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
| //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
| //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
| ///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
| ///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; |