⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 机器学习中文参考手册 - opencv china.htm

📁 When I use opencv, I use this very useful paper to begin the study. This is all I searched from the
💻 HTM
📖 第 1 页 / 共 5 页
字号:
          class=toctext>CvDTree::train</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#CvDTree::predict"><SPAN 
          class=tocnumber>5.7</SPAN> <SPAN 
          class=toctext>CvDTree::predict</SPAN></A> </LI></UL>
        <LI class=toclevel-1><A 
        href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#Boosting"><SPAN 
        class=tocnumber>6</SPAN> <SPAN class=toctext>Boosting</SPAN></A> 
        <UL>
          <LI class=toclevel-2><A 
          href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#CvBoostParams"><SPAN 
          class=tocnumber>6.1</SPAN> <SPAN 
          class=toctext>CvBoostParams</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#CvBoostTree"><SPAN 
          class=tocnumber>6.2</SPAN> <SPAN class=toctext>CvBoostTree</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#CvBoost"><SPAN 
          class=tocnumber>6.3</SPAN> <SPAN class=toctext>CvBoost</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#CvBoost::train"><SPAN 
          class=tocnumber>6.4</SPAN> <SPAN 
          class=toctext>CvBoost::train</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#CvBoost::predict"><SPAN 
          class=tocnumber>6.5</SPAN> <SPAN 
          class=toctext>CvBoost::predict</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#CvBoost::prune"><SPAN 
          class=tocnumber>6.6</SPAN> <SPAN 
          class=toctext>CvBoost::prune</SPAN></A> 
          <LI class=toclevel-2><A 
          href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#CvBoost::get_weak_predictors"><SPAN 
          class=tocnumber>6.7</SPAN> <SPAN 
          class=toctext>CvBoost::get_weak_predictors</SPAN></A> </LI></UL>
        <LI class=toclevel-1><A 
        href="http://www.opencv.org.cn/index.php/机器å&shy;¦ä¹&nbsp;ä¸&shy;文参考手册#.E4.B8.AD.E6.96.87.E7.BF.BB.E8.AF.91.E8.80.85"><SPAN 
        class=tocnumber>7</SPAN> <SPAN class=toctext>中文翻译者</SPAN></A> 
  </LI></UL></TD></TR></TBODY></TABLE>
<P>
<SCRIPT type=text/javascript> if (window.showTocToggle) { var tocShowText = "显示"; var tocHideText = "隐藏"; showTocToggle(); } </SCRIPT>
</P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=1">编辑</A>]</DIV><A 
name=.E7.AE.80.E4.BB.8B.EF.BC.9A.E9.80.9A.E7.94.A8.E7.B1.BB.E5.92.8C.E5.87.BD.E6.95.B0></A>
<H1>简介:通用类和函数</H1>
<P>机器学习库(MLL)是一些用于分类、回归和数据聚类的类和函数。 </P>
<P>大部分分类和回归算法是用C++类来实现。尽管这些算法有一些不同的特性(像处理missing measurements的能力,或者categorical 
input variables等),这些类之间有一些相同之处。这些相同之处在类 CvStatModel 中被定义,其他 ML 类都是从这个类中继承。 </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=2">编辑</A>]</DIV><A 
name=CvStatModel></A>
<H2>CvStatModel</H2>
<P>ML库中的统计模型基类。 </P><PRE>class CvStatModel
{
public:
    /* CvStatModel(); */
    /* CvStatModel( const CvMat* train_data ... ); */

    virtual ~CvStatModel();

    virtual void clear()=0;

    /* virtual bool train( const CvMat* train_data, [int tflag,] ..., const CvMat* responses, ...,
    [const CvMat* var_idx,] ..., [const CvMat* sample_idx,] ...
    [const CvMat* var_type,] ..., [const CvMat* missing_mask,] &lt;misc_training_alg_params&gt; ... )=0;
     */

    /* virtual float predict( const CvMat* sample ... ) const=0; */

    virtual void save( const char* filename, const char* name=0 )=0;
    virtual void load( const char* filename, const char* name=0 )=0;

    virtual void write( CvFileStorage* storage, const char* name )=0;
    virtual void read( CvFileStorage* storage, CvFileNode* node )=0;
};
</PRE>
<P>在上面的声明中,一些函数被注释掉。实际上,一些函数没有一个单一的API(缺省的构造函数除外),然而,在本节後面描述的语法和定义方面有一些相似之处,好像他们是基类的一部分一样。 
</P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=3">编辑</A>]</DIV><A 
name=CvStatModel::CvStatModel></A>
<H2>CvStatModel::CvStatModel</H2>
<P>缺省构造函数 </P><PRE>CvStatModel::CvStatModel();
</PRE>
<P>ML中的每个统计模型都有一个无参数构造函数。This constructor is useful for 2-stage model 
construction, when the default constructor is followed by train() or load(). 
</P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=4">编辑</A>]</DIV><A 
name=CvStatModel::CvStatModel.28....29></A>
<H2>CvStatModel::CvStatModel(...)</H2>
<P>Training constructor </P><PRE>CvStatModel::CvStatModel( const CvMat* train_data ... ); */
</PRE>
<P>Most ML classes provide single-step construct+train constructor. This 
constructor is equivalent to the default constructor, followed by the train() 
method with the parameters that passed to the constructor. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=5">编辑</A>]</DIV><A 
name=CvStatModel::.7ECvStatModel></A>
<H2>CvStatModel::~CvStatModel</H2>
<P>Virtual destructor </P><PRE>CvStatModel::~CvStatModel();
</PRE>
<P>The destructor of the base class is declared as virtual, so it is safe to 
write the following code: </P><PRE>CvStatModel* model;
if( use_svm )
    model = new CvSVM(... /* SVM params */);
else
    model = new CvDTree(... /* Decision tree params */);
...
delete model;
</PRE>
<P>Normally, the destructor of each derived class does nothing, but calls the 
overridden method clear() that deallocates all the memory. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=6">编辑</A>]</DIV><A 
name=CvStatModel::clear></A>
<H2>CvStatModel::clear</H2>
<P>释放内存,重置模型状态 </P><PRE>void CvStatModel::clear();
</PRE>
<P>The method clear does the same job as the destructor, i.e. it deallocates all 
the memory occupied by the class members. But the object itself is not 
destructed, and it can be reused further. This method is called from the 
destructor, from the train methods of the derived classes, from the methods 
load(), read() etc., or even explicitly by user. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=7">编辑</A>]</DIV><A 
name=CvStatModel::save></A>
<H2>CvStatModel::save</H2>
<P>将模型保存到文件 </P><PRE>void CvStatModel::save( const char* filename, const char* name=0 );
</PRE>
<P>The method save stores the complete model state to the specified XML or YAML 
file with the specified name or default name (that depends on the particular 
class). Data persistence functionality from cxcore is used. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=8">编辑</A>]</DIV><A 
name=CvStatModel::load></A>
<H2>CvStatModel::load</H2>
<P>从文件中装载模型 </P><PRE>void CvStatModel::load( const char* filename, const char* name=0 );
</PRE>
<P>The method load loads the complete model state with the specified name (or 
default model-dependent name) from the specified XML or YAML file. The previous 
model state is cleared by clear(). </P>
<P>Note that the method is virtual, therefore any model can be loaded using this 
virtual method. However, unlike the C types of OpenCV that can be loaded using 
generic cvLoad(), in this case the model type must be known anyway, because an 
empty model, an instance of the appropriate class, must be constructed 
beforehand. This limitation will be removed in the later ML versions. </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=9">编辑</A>]</DIV><A 
name=CvStatModel::write></A>
<H2>CvStatModel::write</H2>
<P>将模型写入file storage </P><PRE>void CvStatModel::write( CvFileStorage* storage, const char* name );
</PRE>
<P>The method write stores the complete model state to the file storage with the 
specified name or default name (that depends on the particular class). The 
method is called by save(). </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=10">编辑</A>]</DIV><A 
name=CvStatModel::read></A>
<H2>CvStatModel::read</H2>
<P>Reads the model from file storage </P><PRE>void CvStatMode::read( CvFileStorage* storage, CvFileNode* node );
</PRE>
<P>The method read restores the complete model state from the specified node of 
the file storage. The node must be located by user, for example, using the 
function cvGetFileNodeByName(). The method is called by load(). </P>
<P>The previous model state is cleared by clear(). </P>
<DIV class=editsection style="FLOAT: right; MARGIN-LEFT: 5px">[<A 
title=机器学习中文参考手册 
href="http://www.opencv.org.cn/index.php?title=%E6%9C%BA%E5%99%A8%E5%AD%A6%E4%B9%A0%E4%B8%AD%E6%96%87%E5%8F%82%E8%80%83%E6%89%8B%E5%86%8C&amp;action=edit&amp;section=11">编辑</A>]</DIV><A 
name=CvStatModel::train></A>
<H2>CvStatModel::train</H2>
<P>训练模型 </P><PRE>bool CvStatMode::train( const CvMat* train_data, [int tflag,] ..., const CvMat* responses, ...,
    [const CvMat* var_idx,] ..., [const CvMat* sample_idx,] ...
    [const CvMat* var_type,] ..., [const CvMat* missing_mask,] &lt;misc_training_alg_params&gt; ... );
</PRE>
<P>这个函数利用输入的特征向量和对应的反应值(responses)来训练统计模型。特征向量和其对应的反应值都是用矩阵来表示。缺省情况下,特征向量都以行向量被保存在train_data中,也就是所有的特征向量元素都是连续存储。不过,一些算法可以处理转置表示,即特征向量用列向量来表示,所有特征向量的相同位置的元素连续存储。如果两种排布方式都支持,这个函数的参数tflag可以使用下面的取值: 
</P>
<DL>
  <DT>tflag=CV_ROW_SAMPLE
  <DD>表示特征向量以行向量存储; 
  <DT>tflag=CV_COL_SAMPLE
  <DD>表示特征向量以列向量存储; </DD></DL>
<P>训练数据必须是32fC1(32位的浮点数,单信道)格式 
反应值通常是以向量方式存储(一个行,或者一个列向量),存储格式为32sC1(仅在分类问题中)或者32fC1格式,每个输入特征向量对应一个值(虽然一些算法,比如某几种神经网络,反应值为向量)。 
</P>
<P>对于分类问题,反应值是离散的类别标签;对于回归问题,反应值是被估计函数的输出值。一些算法只能处理分类问题,一些只能处理回归问题,另一些算法这两类问题都能处理。In 
the latter case the type of output variable is either passed as separate 
parameter, or as a last element of var_type vector: CV_VAR_CATEGORICAL means 
that the output values are discrete class labels, 
CV_VAR_ORDERED(=CV_VAR_NUMERICAL) means that the output values are ordered, i.e. 
2 different values can be compared as numbers, and this is a regression problem 
The types of input variables can be also specified using var_type. Most 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -