Skip to content

Instantly share code, notes, and snippets.

View ollewelin's full-sized avatar

Olle Welin ollewelin

View GitHub Profile
//File: NN20.cpp
//New on NN20 is:
//Sum nr0 with nr1 kernel's also on second layer here also with backprop
//New function make_SumChangeFeature_1B_Weights()
//2017- fix bugg in make_SumChangeFeature0Weights replace c_m1 with m1_conv0
//2017- fix bugg in make_SumChangeFeature_0B_Weights replace c_m1 with m1_conv0
//In this example 6 output nodes and explaned training images set in start of program.
float pre_debug_diff = 0.0;
//2017-05-07 find bugg Mat pol_c_m1_unpad(C2M_H,C2M_W,CV_32F); was before bug fix ..C2M_H,C2M_H..
//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.
float pre_debug_diff = 0.0;
float debug_diff = 0.0;
int load_kernels;
@ollewelin
ollewelin / gist:1d2f2b114d2e078924b94b0f5747bedd
Created October 11, 2016 17:57
NN18.cpp Convolution Neural Network
//File: NN18.cpp
//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.
float pre_debug_diff = 0.0;
float debug_diff = 0.0;
int load_kernels;
//Generate Negative samples BGR RGB swapped don't know why this was default OpenCV must have changed on my raspbeery pi suddenly after some updates
//File: test_prog.cpp
//You must make a director /positive_data/ where this program could put the pictures in
#include <stdio.h>
#include <ctime>
#include <iostream>
#include <raspicam/raspicam_cv.h>
#include <opencv2/opencv.hpp>
//Generate Positive samples BGR RGB swapped don't know why this was default OpenCV must have changed on my raspbeery pi suddenly after //some updates
//File: test_prog.cpp
//You must make a director /positive_data/ where this program could put the pictures in
#include <stdio.h>
#include <unistd.h>
#include <ctime>
#include <iostream>
#include <raspicam/raspicam_cv.h>
#include <opencv2/opencv.hpp>
//File: simpletest_raspicam_cv.cpp now swapped BGR to RGB source
//Will test Trained Cascade Object detection
#include <opencv2/highgui/highgui.hpp> // OpenCV window I/O
#include <opencv2/imgproc/imgproc.hpp> // Gaussian Blur
#include <stdio.h>
#include <raspicam/raspicam_cv.h>
#include <opencv2/opencv.hpp>
#include "gpio_test.h"
#include <bcm2835.h>
opencv_createsamples -info info.txt -num 2000 -w 32 -h 24 -vec logo.vec -maxxangle 2.0 -maxyangle 2.0 -maxzangle 2.0 -maxidev 800 -bgthresh 160
opencv_createsamples -vec logo.vec -w 32 -h 24
opencv_traincascade -data data -vec logo.vec -bg bg.txt -precalcValBufSize 768 -precalcIdxBufSize 768 -numPos 1900 -numNeg 1000 -numStages 8 -w 32 -h 24 -featureType LBP -mode ALL -maxFalseAlarmRate 0.1
./0.JPG
./1.JPG
./2.JPG
./3.JPG
./4.JPG
./5.JPG
./6.JPG
./7.JPG
./8.JPG
./9.JPG
pos0.JPG 1 0 0 128 96
pos1.JPG 1 0 0 128 96
pos2.JPG 1 0 0 128 96
pos3.JPG 1 0 0 128 96
pos4.JPG 1 0 0 128 96
pos5.JPG 1 0 0 128 96
pos6.JPG 1 0 0 128 96
pos7.JPG 1 0 0 128 96
pos8.JPG 1 0 0 128 96
pos9.JPG 1 0 0 128 96
#####################################
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 )