Boosting principle
It is known that boosting is called a strong classifier with multiple weak classifiers. And what is called weak classification learning and when to use weak classification learning?
Weak classification Learning
Weak classification Learning: The correct rate of recognition of a set of concepts is only a little higher than the probability of random guessing.
Similarly, when the training group that needs to classify has the above characteristics, the boosting algorithm can be used as a priority.
Important historical events of boosting
- Kearns & Valiant (1984): Boosting Origin
- Kearns & Valiant (1989): The equivalence of weak learners and strong learners is proved.
- Schapire (1989): The first one presents a boosting algorithm that can prove a polynomial event.
- Schapire (1993): For the first time, the idea of boosting algorithm is used in practical applications (OCR).
- Freund & Schapire (1995): AdaBoost algorithm.
The principle of boosting
In order to train a series of weak classifiers h1,h2,.. HT, constantly classifying the samples, after each classification, focuses on the wrong sample, calculates the weight of this classification, and then carries out the wrong sample to the next classifier to learn, and so on.
Finally, all weak classifiers are grouped together:
AdaBoost algorithm
Boosting to implement training image group in OpenCV Cvboostparams
This class is mainly for boosting settings, such as setting the use of which boosting and some training parameters, the default value itself, so if not set, you can directly use the default value.
The default values are as follows:
CvBoostParams::CvBoostParams(){ boost_type = CvBoost::REAL; 100; 0.95; 0; 1;}
If you need to set it, set the method as follows:
params(CvBoost::DISCRETE,100,0.95,0,1);
Cvboostparams::train
voidBoosting_train ( vector<Mat>Mats vector<int>ResponseintClass_count=2) {Cvboost boost;//Use default values if(Mats.size ()! =0) {inttotal=mats[0].cols*mats[0].rows; Mat Mat=mat (Total,mats.size (), CV_64FC1); for(intI=0; I<mats.size (); i++) {Mat col_tmp=mat.col (i); Mats[i].reshape (1, total). Col (0). ConvertTo (COL_TMP,CV_64FC1,1/255.); } Mat Resp=mat (Mats.size (),1, CV_64FC1); for(intI=0; I<response.size (); i++) {resp.at (i),0) =response[i]; } boost.train (mat.t (), CV_ROW_SAMPLE,RESP); }//For better results, you can change the sample number to sample number multiplied by the number of categories, i.e. mats.size () to Mats.size () *class_count}
Reference Document: Http://docs.opencv.org/modules/ml/doc/boosting.html
Reprint Please specify source: http://blog.csdn.net/luoyun614/article/details/44254269
Boosting training from principle to realization of image array