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).
Hii, can you post the training process? I have some problems to set training parameters
ReplyDeleteI plan to post the code about learning method of deep learning.
DeleteHowever, it is difficult for the parameter settings.
because it require understanding of deep learning algorithm.
I think tensor flow is good to study deep learning.
I plan to post later about tensor flow.
Can you open your learning data and parameter?
Then I also try learning.
Thank you.
์๋ ํ์ธ์? ๋ธ๋ก๊ทธ ๋ฐ openCV๊ฐ์ข ์ ์ฉํ๊ฒ ์๋ณด๊ณ ์์ต๋๋ค!! ๋ค๋ฆ์ด์๋๋ผ caffe์ค์น์ ์๋ฌธ์ ์ด ์์ต๋๋ค. ์ผ๋จ github์์ ๊ตฌ์ฑ์์๋ค์ ๋ฐ์๋๋ฐ caffe๋ฅผ ์ถ๊ฐํ๋ ค๋ฉด opencv์ค์นํ ๋ ์ฌ์ฉํ cmakeํ๋ก๊ทธ๋จ์์ ๊ฒฝ๋ก์ง์ ํด์ฃผ๊ณ ๋๊ฐ์ด ์งํํ๋ฉด ๋๋์? ๊ทธ๋ฆฌ๊ณ include ๋๋ ํ ๋ฆฌ๋ ๋ฐ๋ก ์ฐพ์๋๋ฐ caffe_libs๋ ๋ฌด์จ ํ์ผ๋ก ์ง์ ํด์ค์ผํ ์ง ๋ชจ๋ฅด๊ฒ ๋ค์.. ์๋ฌด์ชผ๋ก ๋ต๋ณ๊ธฐ๋ค๋ฆฌ๊ฒ ์ต๋๋ค.
ReplyDelete์๋ ํ์ธ์. ์ ๋ opencv ๋น๋ํ ๋ caffe๋ฅผ ๋ฃ์ด์ ํด๋ณธ ์ ์ด ์์ต๋๋ค. ๊ทธ๋ฐ๋ฐ ๋ฐ๋๋ก caffe ๋น๋ํ ๋, opencv๋ฅผ ํฌํจ์์ผ์ ๋น๋ํ ์ ์ ์์ต๋๋ค.
ReplyDelete๊ทธ๋ ๋จ๊ธด ๊ธ์ http://study.marearts.com/2015/10/deep-learning-library-to-work-easily.html, ์ฐธ๊ณ ํ์ธ์.
์ฌ๊ธฐ https://initialneil.wordpress.com ์๊ฐ๋ ๋ฐฉ๋ฒ์ ๋ฐ๋ผ ํ์ต๋๋ค.
๊ทธ๋ฐ๋ฐ ์ด๊ฒ 2015๋ ์๋ฃ๋ผ์ ๋ ์ต์ ์๋ฃ๋ฅผ ์ฐพ์ ๋ณด๋๊ฒ ์ข์ ๊ฒ ๊ฐ์ต๋๋ค.
์ ๋ opencv์ caffe๋ฅผ ๋ฃ์ด์ ๋น๋๋ฅผ ํด๋ณด๊ณ ์ถ์ต๋๋ค.
์ฑ๊ณตํ๋ฉด ์ ์ฐจ๋ฅผ ๋ธ๋ก๊ทธ์ ์๊ฐํ๊ฒ ์ต๋๋ค.
changhun ๋๋ ์ข์ ์ ๋ณด ์์ผ๋ฉด ์๋ ค์ฃผ์ธ์.
๊ฐ์ฌํฉ๋๋ค.