10/22/2015
10/01/2015
Deep learning Library to work easily with opencv on window environment.
I was wrapping caffe library to use easy with opencv and window os environment(named MareDeepDLL).
MareDeepDll is referenced on
http://caffe.berkeleyvision.org/installation.html
https://initialneil.wordpress.com/
The dll is made on this environment
Window 10 64bit,
VS 2013 64bit
OpenCV 3.0 64bit
cuda 6.5 64bit
tbb 64bit
..
All dependency is as follows:
This code is example to use the dll
...
Lenet model was used to test the deep learning classification.
Many other models are introduced on github model zoo.
https://github.com/BVLC/caffe/wiki/Model-Zoo
You can apply other case, on code cDeep.SetNet("lenet_test-memory-1.prototxt", "lenet_iter_10000.caffemodel"); , first param means model structure and second param means the result of deep learning.
If you request to Google Plus to me, I will send the dll with the application code(project).
MareDeepDll is referenced on
http://caffe.berkeleyvision.org/installation.html
https://initialneil.wordpress.com/
The dll is made on this environment
Window 10 64bit,
VS 2013 64bit
OpenCV 3.0 64bit
cuda 6.5 64bit
tbb 64bit
..
All dependency is as follows:
This code is example to use the dll
...
#include < iostream>
#include < stdio.h>
#include < vector>
#include < time.h>
#include < opencv2\opencv.hpp>
#include < opencv2\core.hpp>
#include < opencv2\highgui.hpp>
#include < opencv2\videoio.hpp>
#include < opencv2\imgproc.hpp>
#include "DeepDll_B.h"
#ifdef _DEBUG
#pragma comment(lib, "opencv_core300d.lib")
#pragma comment(lib, "opencv_highgui300d.lib")
#pragma comment(lib, "opencv_imgcodecs300d.lib")
#pragma comment(lib, "opencv_imgproc300d.lib") //line, circle
#else
#pragma comment(lib, "opencv_core300.lib")
#pragma comment(lib, "opencv_highgui300.lib")
#pragma comment(lib, "opencv_imgcodecs300.lib")
#pragma comment(lib, "opencv_imgproc300.lib") //line, circle
//DEEP lib
#pragma comment(lib, "MareDeepDLL.lib")
#endif
using namespace cv;
using namespace std;
void main()
{
//DEEP Class
MareDeepDll_B cDeep;
//load model and structure
cDeep.SetNet("lenet_test-memory-1.prototxt", "lenet_iter_10000.caffemodel");
//gpu using on
cDeep.GPU_using();
for (int i = 1; i < 14; ++i)
{
// time check..
unsigned long AAtime = 0, BBtime = 0;
AAtime = getTickCount();
//make file name
char str[256];
sprintf_s(str, "%d.jpg", i);
printf("%s\n", str);
//img load and preprocessing
Mat img = imread(str);
resize(img, img, Size(28, 28));
cvtColor(img, img, CV_BGR2GRAY);
////////////
//classify
vector< double> rV;
//image and class num (caution!! class num is dependented by learning condition.) lenet is classify one number in 10 digits.
rV = cDeep.eval(img, 10);
/////////////
//result out
for (int i = 0; i < rV.size(); i++) {
printf("Probability to be Number %d is %.3f\n", i, rV[i]);
}
// processing time check.
BBtime = getTickCount();
printf("%.2lf sec / %.2lf fps\n", (BBtime - AAtime) / getTickFrequency(), 1 / ((BBtime - AAtime) / getTickFrequency()));
//draw
namedWindow("test", 0);
imshow("test", img);
waitKey(0);
}
}
...Lenet model was used to test the deep learning classification.
Many other models are introduced on github model zoo.
https://github.com/BVLC/caffe/wiki/Model-Zoo
You can apply other case, on code cDeep.SetNet("lenet_test-memory-1.prototxt", "lenet_iter_10000.caffemodel"); , first param means model structure and second param means the result of deep learning.
If you request to Google Plus to me, I will send the dll with the application code(project).
Labels:
Deep learning,
Handwritten Digit Recognition,
Total
Subscribe to:
Comments (Atom)
-
Logistic Classifier The logistic classifier is similar to equation of the plane. W is weight vector, X is input vector and y is output...
-
The MNIST dataset is a dataset of handwritten digits, comprising 60 000 training examples and 10 000 test examples. The dataset can be downl...
-
This is data acquisition source code of LMS511(SICK co.) Source code is made by MFC(vs 2008). The sensor is communicated by TCP/IP. ...
-
Image size of origin is 320*240. Processing time is 30.96 second took. The result of stitching The resul...
-
Created Date : 2011.2 Language : C/C++ Tool : Microsoft Visual C++ 2010 Library & Utilized : OpenCV 2.2 Reference : Interent Refer...
-
Google Coral USB Edge TPU Implementation Guide 1. Installation and Troubleshooting 1.1 Hardware Requirements Google Coral USB Accelerator ...
-
Background subtractor example souce code. OpenCV support about 3 types subtraction algorithm. Those are MOG, MOG2, GMG algorithms. Det...
-
This example source code is to extract HOG feature from images. And save descriptors to XML file. The source code explain how to use HOGD...
-
RTSP(Real Time Streaming Protocol) is video streaming, it usually sent from network camera. VideoCapture function in opencv also can get r...
-
Created Date : 2011.10 Language : C/C++ Tool : Microsoft Visual C++ 2008 Library & Utilized : OpenCV 2.3 Reference : SIFT referenc...