Skip to content

Instantly share code, notes, and snippets.

View LaurentBerger's full-sized avatar

Laurent Berger LaurentBerger

View GitHub Profile
ADMIN
Number of platforms: 1
Platform Profile: FULL_PROFILE
Platform Version: OpenCL 1.2 CUDA 9.0.191
Platform Name: NVIDIA CUDA
Platform Vendor: NVIDIA Corporation
Platform Extensions: cl_khr_global_int32_base_atomics cl_khr_global_int32_extended_atomics cl_khr_local_int32_base_atomics cl_khr_local_int32_extended_atomics cl_khr_fp64 cl_khr_byte_addressable_store cl_khr_icd cl_khr_gl_sharing cl_nv_compiler_options cl_nv_device_attribute_query cl_nv_pragma_unroll cl_nv_d3d10_sharing cl_khr_d3d10_sharing cl_nv_d3d11_sharing cl_nv_copy_opts cl_nv_create_buffer
int train_backprop( const Mat& inputs, const Mat& outputs, const Mat& _sw, TermCriteria termCrit )
{
int i, j, k;
double prev_E = DBL_MAX*0.5, E = 0;
int itype = inputs.type(), otype = outputs.type();
int count = inputs.rows;
int iter = -1, max_iter = 100;//termCrit.maxCount*count;
double epsilon = termCrit.epsilon*count;
#define GENERATE_TESTDATA
TEST(ML_ANN, Method)
{
String folder = string(cvtest::TS::ptr()->get_data_path());
String original_path = folder + "waveform.data";
String dataname = folder + "waveform";
Ptr<TrainData> tdata2 = TrainData::loadFromCSV(original_path, 0);
Mat responses(tdata2->getResponses().rows, 3, CV_32FC1, Scalar(0));
for (int i = 0; i<tdata2->getResponses().rows; i++)
%YAML:1.0
---
opencv_ml_ann_mlp:
format: 3
layer_sizes: [ 21, 30, 3 ]
activation_function: SIGMOID_SYM
f_param1: 6.6666666666666663e-01
f_param2: 1.7159000000000000e+00
min_val: -9.4999999999999996e-01
max_val: 9.4999999999999996e-01
%YAML:1.0
---
opencv_ml_ann_mlp:
format: 3
layer_sizes: [ 21, 30, 3 ]
activation_function: SIGMOID_SYM
f_param1: 6.6666666666666663e-01
f_param2: 1.7159000000000000e+00
min_val: -9.4999999999999996e-01
max_val: 9.4999999999999996e-01
#include <opencv2/opencv.hpp>
#include <iostream>
#include <map>
#include <opencv2/ts.hpp>
#include "opencv2/ml.hpp"
#include "opencv2/core/core_c.h"
using namespace std;
#!/bin/bash -e
myRepo=$(pwd)
CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"
RepoSource=opencv
cd Build/$RepoSource
CMAKE_OPTIONS='-DBUILD_opencv_world:BOOL=OFF -DBUILD_PERF_TESTS:BOOL=OFF -DBUILD_TESTS:BOOL=ON -DBUILD_DOCS:BOOL=OFF -DWITH_CUDA:BOOL=OFF -DBUILD_EXAMPLES:BOOL=ON -DWITH_LAPACK:BOOL=ON -DCV_TRACE:BOOL=OFF'
cmake -G"$CMAKE_CONFIG_GENERATOR" \
-DTesseract_INCLUDE_DIR:PATH="${myRepo}"/Install/tesseract/include -DTesseract_LIBRARY="${myRepo}"/Install/tesseract/lib/tesseract400.lib -DLept_LIBRARY="${myRepo}"/Install/leptonica/lib/leptonica-1.74.4.lib \
-DEIGEN_DIR:PATH="$myRepo"/eigen -DEIGEN_INCLUDE_DIR="$myRepo"/eigen -DEIGEN_INCLUDE_PATH="$myRepo"/eigen \
-DCeres_DIR="$myRepo"/install/ceres-solver/cmake -Dglog_DIR:PATH="$myRepo"/install/glog/lib/cmake/glog -Dgflags_DIR:PATH="$myRepo"/install/gflags/lib/cmake/gflags \
@LaurentBerger
LaurentBerger / gist:1de4b75aab61dd57d9493a4a97ede777
Created February 14, 2018 18:25
runnning cpp_xor windows 10 msvc 2017
WARNING: Logging before InitGoogleLogging() is written to STDERR
I0214 19:15:50.821849 7128 solver.cpp:44] Initializing solver from parameters:
test_iter: 1
test_interval: 2000
base_lr: 0.02
display: 2000
max_iter: 5000000
lr_policy: "step"
gamma: 0.5
stepsize: 500000
$ ./buildcaffe2.sh
/g/lib/Build/Caffe2 /g/lib
-- The CXX compiler identification is MSVC 19.12.25834.0
-- The C compiler identification is MSVC 19.12.25834.0
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Enterprise/VC/Tools/MSVC/14.12.25827/bin/Hostx64/x64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
#!/bin/bash -e
myRepo=$(pwd)
CMAKE_CONFIG_GENERATOR="Visual Studio 15 2017 Win64"
RepoSource=Caffe2
RepoBuild=Caffe2
installDepen=G:/Lib/install
pushd Build/$RepoBuild
CMAKE_OPTIONS=''
cmake -G"$CMAKE_CONFIG_GENERATOR" -DBUILD_SHARED_LIBS:BOOL=ON \
-DPYTHON_EXECUTABLE=c:/programdata/anaconda3/python.exe \