当前位置: 首页 > news >正文

做巧克力的网站产品seo是什么意思

做巧克力的网站,产品seo是什么意思,黑群晖做网站,wordpress最好最全的教程如需转载请注明本博网址:http://blog.csdn.net/ding977921830/article/details/47733363。 一 训练框架 训练人脸检測分类器须要三个步骤: (1) 准备正负样本集,分别放到两个目录里。我使用的是麻省理工的那个人脸库。大家能够网上搜一下。 &…

如需转载请注明本博网址:http://blog.csdn.net/ding977921830/article/details/47733363。

一  训练框架

训练人脸检測分类器须要三个步骤:

(1) 准备正负样本集,分别放到两个目录里。

我使用的是麻省理工的那个人脸库。大家能够网上搜一下。

(2)把正样本集生成正样本描写叙述文件(*.vec),把负样本集生成负样本集合文件。详细怎么操作请參考我博客中的另外两篇文章,各自是http://blog.csdn.net/ding977921830/article/details/45913789和http://blog.csdn.net/ding977921830/article/details/45914137。

(3)利用........\opencv\sources\apps\haartraining\haartraining.cpp训练分类器。

二  建立project

我使用的是vs2012和opencv2.4.9,事实上,使用其它的版本号也区别不多大。

1  配置opencv2.4.9和vs2012,这个网上有非常多资料,我就不啰嗦了哈。

2  在vs中新建project,把opencv库中的以下文件........\opencv\sources\apps\haartraining加入到project中,在解决方式资源管理器中,分别加入头文件和源文件,加入好后,内容例如以下:


三  程序

上面main.cpp的内容也就是haartraining.cpp中的程序,详细内容例如以下:

//M*//** haartraining.cpp*里面有部分參数我是稍作改动*<a target=_blank href="http://blog.csdn.net/ding977921830/article/details/47733363">http://blog.csdn.net/ding977921830/article/details/47733363</a>* Train cascade classifier*/#include <cstdio>
#include <cstring>
#include <cstdlib>using namespace std;#include "cvhaartraining.h"int main( int argc, char* argv[] )
{int i = 0;char* nullname = (char*)"(NULL)";char* vecname = NULL;char* dirname = NULL;char* bgname  = NULL;bool bg_vecfile = false;int npos    = 2000;   //保证npos与nneg的比例为1:2至1::3之间比較好int nneg    = 4000;int nstages = 3;      //为了节约时间能够把把设置为1,或2或3。当然也能够设置十几或二十几。只是,我没有耐心实验int mem     = 200;int nsplits = 1;float minhitrate     = 0.995F;float maxfalsealarm  = 0.5F;float weightfraction = 0.95F;int mode         = 0;int symmetric    = 1;int equalweights = 0;int width  = 20;int height = 20;const char* boosttypes[] = { "DAB", "RAB", "LB", "GAB" };int boosttype = 0;    //选用DABconst char* stumperrors[] = { "misclass", "gini", "entropy" };int stumperror = 0;   //选用misclassint maxtreesplits = 0;int minpos = 500;if( argc == 1 ){printf( "Usage: %s\n  -data <dir_name>\n""  -vec <vec_file_name>\n""  -bg <background_file_name>\n""  [-bg-vecfile]\n""  [-npos <number_of_positive_samples = %d>]\n""  [-nneg <number_of_negative_samples = %d>]\n""  [-nstages <number_of_stages = %d>]\n""  [-nsplits <number_of_splits = %d>]\n""  [-mem <memory_in_MB = %d>]\n""  [-sym (default)] [-nonsym]\n""  [-minhitrate <min_hit_rate = %f>]\n""  [-maxfalsealarm <max_false_alarm_rate = %f>]\n""  [-weighttrimming <weight_trimming = %f>]\n""  [-eqw]\n""  [-mode <BASIC (default) | CORE | ALL>]\n""  [-w <sample_width = %d>]\n""  [-h <sample_height = %d>]\n""  [-bt <DAB | RAB | LB | GAB (default)>]\n""  [-err <misclass (default) | gini | entropy>]\n""  [-maxtreesplits <max_number_of_splits_in_tree_cascade = %d>]\n""  [-minpos <min_number_of_positive_samples_per_cluster = %d>]\n",argv[0], npos, nneg, nstages, nsplits, mem,minhitrate, maxfalsealarm, weightfraction, width, height,maxtreesplits, minpos );return 0;}for( i = 1; i < argc; i++ ){/*if( !strcmp( argv[i], "-data" ) ){dirname = argv[++i];}else if( !strcmp( argv[i], "-vec" ) ){vecname = argv[++i];}else if( !strcmp( argv[i], "-bg" ) ){bgname = argv[++i];}*/if( !strcmp( argv[i], "-data" ) )    //前面这三个条件里面的内容我稍作改动{dirname = argv[i];}else if( !strcmp( argv[i], "-vec.vec" ) ){vecname = argv[i];}else if( !strcmp( argv[i], "-bg.txt" ) ){bgname = argv[i];}else if( !strcmp( argv[i], "-bg-vecfile" ) ){bg_vecfile = true;}else if( !strcmp( argv[i], "-npos" ) ){npos = atoi( argv[++i] );}else if( !strcmp( argv[i], "-nneg" ) ){nneg = atoi( argv[++i] );}else if( !strcmp( argv[i], "-nstages" ) ){nstages = atoi( argv[++i] );}else if( !strcmp( argv[i], "-nsplits" ) ){nsplits = atoi( argv[++i] );}else if( !strcmp( argv[i], "-mem" ) ){mem = atoi( argv[++i] );}else if( !strcmp( argv[i], "-sym" ) ){symmetric = 1;}else if( !strcmp( argv[i], "-nonsym" ) ){symmetric = 0;}else if( !strcmp( argv[i], "-minhitrate" ) ){minhitrate = (float) atof( argv[++i] );}else if( !strcmp( argv[i], "-maxfalsealarm" ) ){maxfalsealarm = (float) atof( argv[++i] );}else if( !strcmp( argv[i], "-weighttrimming" ) ){weightfraction = (float) atof( argv[++i] );}else if( !strcmp( argv[i], "-eqw" ) ){equalweights = 1;}else if( !strcmp( argv[i], "-mode" ) ){char* tmp = argv[++i];if( !strcmp( tmp, "CORE" ) ){mode = 1;}else if( !strcmp( tmp, "ALL" ) ){mode = 2;}else{mode = 0;}}else if( !strcmp( argv[i], "-w" ) ){width = atoi( argv[++i] );}else if( !strcmp( argv[i], "-h" ) ){height = atoi( argv[++i] );}else if( !strcmp( argv[i], "-bt" ) ){i++;if( !strcmp( argv[i], boosttypes[0] ) ){boosttype = 0;}else if( !strcmp( argv[i], boosttypes[1] ) ){boosttype = 1;}else if( !strcmp( argv[i], boosttypes[2] ) ){boosttype = 2;}else{boosttype = 3;}}else if( !strcmp( argv[i], "-err" ) ){i++;if( !strcmp( argv[i], stumperrors[0] ) ){stumperror = 0;}else if( !strcmp( argv[i], stumperrors[1] ) ){stumperror = 1;}else{stumperror = 2;}}else if( !strcmp( argv[i], "-maxtreesplits" ) ){maxtreesplits = atoi( argv[++i] );}else if( !strcmp( argv[i], "-minpos" ) ){minpos = atoi( argv[++i] );}}printf( "Data dir name: %s\n", ((dirname == NULL) ? nullname : dirname ) );printf( "Vec file name: %s\n", ((vecname == NULL) ? nullname : vecname ) );printf( "BG  file name: %s, is a vecfile: %s\n", ((bgname == NULL) ? nullname : bgname ), bg_vecfile ? "yes" : "no" );printf( "Num pos: %d\n", npos );printf( "Num neg: %d\n", nneg );printf( "Num stages: %d\n", nstages );printf( "Num splits: %d (%s as weak classifier)\n", nsplits,(nsplits == 1) ?

"stump" : "tree" ); printf( "Mem: %d MB\n", mem ); printf( "Symmetric: %s\n", (symmetric) ? "TRUE" : "FALSE" ); printf( "Min hit rate: %f\n", minhitrate ); printf( "Max false alarm rate: %f\n", maxfalsealarm ); printf( "Weight trimming: %f\n", weightfraction ); printf( "Equal weights: %s\n", (equalweights) ? "TRUE" : "FALSE" ); printf( "Mode: %s\n", ( (mode == 0) ? "BASIC" : ( (mode == 1) ? "CORE" : "ALL") ) ); printf( "Width: %d\n", width ); printf( "Height: %d\n", height ); //printf( "Max num of precalculated features: %d\n", numprecalculated ); printf( "Applied boosting algorithm: %s\n", boosttypes[boosttype] ); printf( "Error (valid only for Discrete and Real AdaBoost): %s\n", stumperrors[stumperror] ); printf( "Max number of splits in tree cascade: %d\n", maxtreesplits ); printf( "Min number of positive samples per cluster: %d\n", minpos ); cvCreateTreeCascadeClassifier( dirname, vecname, bgname, npos, nneg, nstages, mem, nsplits, minhitrate, maxfalsealarm, weightfraction, mode, symmetric, equalweights, width, height, boosttype, stumperror, maxtreesplits, minpos, bg_vecfile ); return 0; }

我的命令行參数为:"D:\vs2012\projects\train_opencv_main\train_cascade\Debug\test.exe" "-data"  "-vec.vec"  "-bg.txt"

。详细设置方法是  调试----属性----配置属性----调试---命令參数


1 注意命令行參数中间要有空格的。

2 当中第一个你要改动为你自己电脑上project的绝对路径;

3 "-data" 是存放训练好的分类器,须要预先建立好一个的空目录。

4 "-vec.vec" 是我的正样本描写叙述文件。

5 "-bg.txt"是我的负样本集合文件。

四  训练结果

1  dos操作窗体

2  data目录的内容为:

我的0文件里训练了6个弱文类器。1文件里含有9个弱分类器。2目录下有17个弱分类器,每个目录就是一个级联stage。显然是越来越复杂的哈。


3  以文件0为例,里面的内容为:

6
1
2
7 1 6 10 0 -1
9 1 2 10 0 3
haar_x3
4.792333e-002 0 -1
-1.845703e+000 1.845703e+000
1
2
1 3 18 12 0 -1
1 7 18 4 0 3
haar_y3
2.389797e-001 0 -1
-1.396623e+000 1.396623e+000
1
3
2 16 6 4 0 -1
2 16 3 2 0 2
5 18 3 2 0 2
haar_x2_y2
6.900427e-003 0 -1
-9.798445e-001 9.798445e-001
1
2
10 0 10 1 0 -1
10 0 5 1 0 2
haar_x2
1.219139e-002 0 -1
-5.156118e-001 5.156118e-001
1
2
0 0 10 1 0 -1
5 0 5 1 0 2
haar_x2
1.014664e-002 0 -1
-7.365732e-001 7.365732e-001
1
2
9 14 5 3 0 -1
9 15 5 1 0 3
haar_y3
-6.578934e-003 0 -1
7.885281e-001 -7.885281e-001
-3.758514e+000

-1
-1

4  xml文件

到这里我们的训练分类器最终出来的,XML文件能够在在vs中直接调用了。xml文件的内容你看是跟上面data文件里的内容是严格一一相应的,我摘录当中部分内容(也就是0目录部分)例如以下:

<?xml version="1.0"?>
<opencv_storage>
<_-data type_id="opencv-haar-classifier">
  <size>
    20 20</size>
  <stages>
    <_>
      <!-- stage 0 -->
      <trees>
        <_>
          <!-- tree 0 -->
          <_>
            <!-- root node -->
            <feature>
              <rects>
                <_>
                  7 1 6 10 -1.</_>
                <_>
                  9 1 2 10 3.</_></rects>
              <tilted>0</tilted></feature>
            <threshold>4.7923330217599869e-002</threshold>
            <left_val>-1.8457030057907104e+000</left_val>
            <right_val>1.8457030057907104e+000</right_val></_></_>
        <_>
          <!-- tree 1 -->
          <_>
            <!-- root node -->
            <feature>
              <rects>
                <_>
                  1 3 18 12 -1.</_>
                <_>
                  1 7 18 4 3.</_></rects>
              <tilted>0</tilted></feature>
            <threshold>2.3897969722747803e-001</threshold>
            <left_val>-1.3966230154037476e+000</left_val>
            <right_val>1.3966230154037476e+000</right_val></_></_>
        <_>
          <!-- tree 2 -->
          <_>
            <!-- root node -->
            <feature>
              <rects>
                <_>
                  2 16 6 4 -1.</_>
                <_>
                  2 16 3 2 2.</_>
                <_>
                  5 18 3 2 2.</_></rects>
              <tilted>0</tilted></feature>
            <threshold>6.9004269316792488e-003</threshold>
            <left_val>-9.7984451055526733e-001</left_val>
            <right_val>9.7984451055526733e-001</right_val></_></_>
        <_>
          <!-- tree 3 -->
          <_>
            <!-- root node -->
            <feature>
              <rects>
                <_>
                  10 0 10 1 -1.</_>
                <_>
                  10 0 5 1 2.</_></rects>
              <tilted>0</tilted></feature>
            <threshold>1.2191389687359333e-002</threshold>
            <left_val>-5.1561182737350464e-001</left_val>
            <right_val>5.1561182737350464e-001</right_val></_></_>
        <_>
          <!-- tree 4 -->
          <_>
            <!-- root node -->
            <feature>
              <rects>
                <_>
                  0 0 10 1 -1.</_>
                <_>
                  5 0 5 1 2.</_></rects>
              <tilted>0</tilted></feature>
            <threshold>1.0146640241146088e-002</threshold>
            <left_val>-7.3657321929931641e-001</left_val>
            <right_val>7.3657321929931641e-001</right_val></_></_>
        <_>
          <!-- tree 5 -->
          <_>
            <!-- root node -->
            <feature>
              <rects>
                <_>
                  9 14 5 3 -1.</_>
                <_>
                  9 15 5 1 3.</_></rects>
              <tilted>0</tilted></feature>
            <threshold>-6.5789339132606983e-003</threshold>
            <left_val>7.8852808475494385e-001</left_val>
            <right_val>-7.8852808475494385e-001</right_val></_></_></trees>
      <stage_threshold>-3.7585139274597168e+000</stage_threshold>
      <parent>-1</parent>
      <next>-1</next></_>
    <_>


转载于:https://www.cnblogs.com/jzssuanfa/p/6941643.html

http://www.lbrq.cn/news/2357623.html

相关文章:

  • 潍坊网站建设服务好用的搜索引擎
  • 免费给人做网站的海城seo网站排名优化推广
  • 青岛做网站企业自动搜索关键词软件
  • 深圳网站建设怎样做郑州网络推广培训
  • 网站的模板演示怎么做google推广费用
  • 做电影网站考什么杭州网站优化企业
  • 如何做网站给女朋友河南网站推广优化
  • 北京建设局网站首页公司网站排名
  • 网站设计是用ps做图吗网站推广的内容
  • 做网站销售提成怎么算营销型网站的类型
  • 重庆市建设工程信息网站诚信分独立网站和平台网站
  • 360推广 网站建设百度大搜是什么
  • 网站建设和优化排名网站快速排名案例
  • 做衣服视频有些什么网站上海外贸网站seo
  • 廉江网站开发公司网络推广优化平台
  • 网站建设公司发展历程网站优化外包
  • 张家港网站建设门店目录搜索引擎有哪些
  • 福建网站建设公司排名推广方案万能模板
  • 衡水安徽网站建设网络优化工程师是干什么的
  • 建设公司简介怎么写电脑优化系统的软件哪个好
  • 东莞网站建设最牛百度seo推广计划类型包含
  • 网站的布局和配色友情链接有用吗
  • 电脑上制作ppt的步骤seo免费培训教程
  • 网站建设xunmei清远今日头条最新消息
  • 如何做网站庆祝她生日快乐网络推广优化seo
  • 青岛网站维护浙江网络推广
  • 网站建设合同的效力泰安网站制作推广
  • 建设网站好公司爱站网关键词密度
  • 网站建设多少钱个人品牌推广方案怎么写
  • 广州市建设企业网站报价百度销售平台怎样联系
  • Nginx,MD5和Knife4j
  • 个人笔记(linux/sort与uniq命令)
  • 李宏毅《生成式人工智能导论》 | 第11讲-第14讲:大型语言模型的可解释性、能力评估、安全性
  • 解锁Redis:从安装到配置的全攻略
  • B站自动回复工具(破解)
  • 八、nginx搭建,实现vue跳转nginx跳转gateway