标签:cvbooststarttraining cvboosttrainer opencv源码分析
原文如下:
/***************************************************************************************** Iterative training functions * \****************************************************************************************/ /* * CvBoostTrainer * * The CvBoostTrainer structure represents internal boosting trainer. */ typedef struct CvBoostTrainer CvBoostTrainer; /* * cvBoostStartTraining * * The cvBoostStartTraining function starts training process and calculates * response values and weights for the first weak classifier training. * * Parameters * trainClasses * Vector of classes of training samples classes. Each element must be 0 or 1 and * of type CV_32FC1. * weakTrainVals * Vector of response values for the first trained weak classifier. * Must be of type CV_32FC1. * weights * Weight vector of training samples for the first trained weak classifier. * Must be of type CV_32FC1. * type * Boosting type. CV_DABCLASS, CV_RABCLASS, CV_LBCLASS, CV_GABCLASS * types are supported. * * Return Values * The return value is a pointer to internal trainer structure which is used * to perform next training iterations. * * Remarks * weakTrainVals and weights must be allocated before calling the function * and of the same size as trainingClasses. Usually weights should be initialized * with 1.0 value. * The function calculates response values and weights for the first weak * classifier training and stores them into weakTrainVals and weights * respectively. * Note, the training of the weak classifier using weakTrainVals, weight, * trainingData is outside of this function. */ CV_BOOST_API CvBoostTrainer* cvBoostStartTraining( CvMat* trainClasses, CvMat* weakTrainVals, CvMat* weights, CvMat* sampleIdx, CvBoostType type );翻译如下:
/***************************************************************************************** 迭代训练函数 * \****************************************************************************************/ /* * CvBoostTrainer * * 该结构体是内部提升训练的trainer结构体 */ typedef struct CvBoostTrainer CvBoostTrainer; /* * cvBoostStartTraining * * 该函数的作用是在第一个弱分类器训练时,初始化训练过程,计算特征值,并初始化样本权重 * * 参数含义如下: * trainClasses * 它是训练样本类的向量,每个元素要么是0,要么是1;而且数据0,1的数据烈性必须是CV_32FC1,即32位浮点型单通道的类型 * weakTrainVals * 第一个训练好的弱分类器的响应值,数据类型是CV_32FC1. * 注:响应值,我的理解是正负样本在该弱分类器下有个预测值,0或者1,可能与原来的类别相同,也可能不同,以为这是个预测过程,不可能100%。 * weights * 第一个训练好的弱分类器的权重的向量,数据类型也必须为CV_32FC1. * type * Boosting type.包括四种: CV_DABCLASS, CV_RABCLASS, CV_LBCLASS, CV_GABCLASS * * Return Values * 返回值是一个CvBoostTrainer的结构体指针,该指针用来进行下一步迭代训练过程 * * Remarks * weakTrainVals 和 weights 必须在回调函数使用前分配,他们的大小都与trainingClasses相同,即具有同样的行和列。 * 一般的,weights 初始化为1.0 * cvBoostStartTraining函数在训练第一个弱分类器时,计算每个样本的响应值weakTrainVals和权重,并且分别存储在指针变量 weakTrainVals and weights里。 * 注意:使用weakTrainVals, weight,trainingdata的训练过程是在这个函数外部 */ CV_BOOST_API CvBoostTrainer* cvBoostStartTraining( CvMat* trainClasses, CvMat* weakTrainVals, CvMat* weights, CvMat* sampleIdx, CvBoostType type );
标签:cvbooststarttraining cvboosttrainer opencv源码分析
原文地址:http://blog.csdn.net/ding977921830/article/details/46646175