资源简介
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
相关资源
- ddos压力测试工具99657
- GBT 15532-2008 计算机软件测试规范
- 清翔电子MCS51开发板资料_新版 01_开发
- PCIe速度测试例程
- Labview与CH372CH375的通信测试
- 德卡D3读卡器测试程序驱动文件
- stm32 ds18b20 温度传感器 测试通过
- ADNS-3080光流传感器测试程序Arduino
- 一个测试报告的模板,有点用
- 音频测试软件
- GIS项目开发文档(分析、设计、实现
- 2410的led测试程序keil可以用
- 报文模拟仿真测试工具2.0
- 短信测试软件
- 硬件测试面试常见题PDF
- Junit4单元测试
- 软件方法测试RTX时钟
- 软件工程文档模板1可行性研究报告
- SAP ABAP培训练习题
- 历年深信服软件测试师考试题
- VC 6 Modbus RTU测试程序
- 小学数学测试成绩查询软件
- 一个不错的测试用例计划——物业管
- 哲学家进餐问题 算法 vc源代码 测试通
- CD7110客显测试程序
- 软件开发过程文档(开发大纲 编写规
- pb (powerbuilder) 编写的自动转台控制
- 学生心理测试系统!!!
- 物业管理系统测试计划范文
- autoit自动化测试小工具及帮助(二)
评论
共有 条评论