91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

資源簡介

adaboost訓練和測試的源代碼,QT工程文件

資源截圖

代碼片段和文件信息

#include?
#include?“opencv/cv.h“
#include?“opencv/ml.h“
#include?
using?namespace?std;
using?namespace?cv;
void?help()
{

????printf(“adaboost??“);
}

int?main(int?argc?char*argv[])?{

????help();
//1.?Declare?a?structure?to?keep?the?data
CvMLData?cvml;
//2.?Read?the?file
cvml.read_csv(argv[1]);

//3.?Indicate?which?column?is?the?response
cvml.set_response_idx(0);

//if(!cvml.CvMLData)
//????printf(“empty“);

//1.?Select?40?for?the?training
CvTrainTestSplit?cvtts(10000?true);
//2.?Assign?the?division?to?the?data
cvml.set_train_test_split(&cvtts);

printf(“Training?...?“);

//1.?Declare?the?classifier
CvBoost?boost;

//2.?Train?it?with?100?features
boost.train(&cvml?CvBoostParams(CvBoost::REAL?2116?0.95?1000?false?0)?true);

//CvBoostParams的參數含義分別是:(1)使用REAL?adaboost,
//(2)100個分類器,
//(3)樣本總權值小于1.0-0.95?=?0.05的點將不參加下一次的迭代
//(4)訓練樹的最大深度是5
//(5)不使用代理分裂
//(6)沒有定義自己的錯分類代價


//?1.?Declare?a?couple?of?vectors?to?save?the?predictions?of?each?sample
std::vector?train_responses?test_responses;
//?2.?Calculate?the?training?error
float?fl1?=?boost.calc_error(&cvmlCV_TRAIN_ERROR&train_responses);
//?3.?Calculate?the?test?error
float?fl2?=?boost.calc_error(&cvmlCV_TEST_ERROR&test_responses);
printf(“Error?train?%f?\n“?fl1);
printf(“Error?test?%f?\n“?fl2);


//?Save?the?trained?classifier
boost.save(argv[2]?“boost“);

//CvMat?*SampleData?=?cvCreateMat(1?10?CV_32FC1);

//boost.load(“./trained_boosttrue.xml“);

//float?x?=?boost.predict(SampleDataMat()Range::all()falsefalse);
//cout<printf(“exit“);
return?EXIT_SUCCESS;
}

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件????????328??2013-08-06?14:47??adaboost\adaboost訓練1\adaboost.pro

?????文件??????12853??2013-08-27?14:06??adaboost\adaboost訓練1\adaboost.pro.user

?????文件???????1803??2013-08-08?19:45??adaboost\adaboost訓練1\main.cpp

?????文件????????181??2013-08-27?14:35??adaboost\adaboost訓練1\readme.txt

?????文件???????2156??2013-08-08?22:57??adaboost\adaboost預測\main.cpp

?????文件????????326??2013-08-08?10:43??adaboost\adaboost預測\pridict.pro

?????文件??????17281??2013-08-27?14:49??adaboost\adaboost預測\pridict.pro.user

?????文件????????182??2013-08-27?14:54??adaboost\adaboost預測\readme.txt

?????目錄??????????0??2013-12-09?14:15??adaboost\adaboost訓練1

?????目錄??????????0??2013-12-09?14:15??adaboost\adaboost預測

?????目錄??????????0??2013-12-09?14:29??adaboost

-----------?---------??----------?-----??----

????????????????35110????????????????????11


評論

共有 條評論