AdaBoost Training Parameters Detailed

Source: Internet
Author: User

Use AdaBoost training face classifier, mainly do a few things, prepare positive and negative samples, generate positive sample Pos.vec file, Generate negative sample list file, training, etc., can see these several blogs:
Http://blog.csdn.net/u013355191/article/details/40381107, don't dwell on it here.

Documenting what I understand in the research process, the specific meaning and usefulness of generating the positive sample program CreateSamples.exe and all the parameters of the training program Opencv_haartraining.exe.

CreateSamples.exe parameter explanation

This executable program is mainly used to generate a positive sample for training, located in the \opencv\build\common directory, the old version named: Createsamples.exe
There are four branches in the main function of the program:

if( imagename && vecname ){cvCreateTrainingSamples( vecname, imagename, bgcolor,    bgthreshold, bgfilename,num, invert, maxintensitydev,maxxangle, maxyangle, maxzangle,showsamples, width, height );

Create multiple positive samples with the warp distortion of the incoming single picture, and if you have a single incoming image path and a positive sample VEC path, walk to this branch:

Vecname: To generate the path to the Vec file for training, the content is Xxx/xxx/xxx/xxx.vec, for example, by-vec Xxx/xxx/xxx/xxx.vec incoming

ImageName: The path to a single sample picture of multiple images through a distorted shape of a picture. For example, by-img xxx/xxx/xxx/xxx.jpg incoming

BgColor: This is the pixel value in the sample warp function that determines whether the pixel is valid when the sample is created, and as the base value of the background filter preserves the pixel value in pixels other than (bgcolor-bgthreshold) and (Bgcolor+bgthreshold) to produce a positive sample, Because the grayscale image is being manipulated, the value 0 range is ~255. For example by:-bgcolor 128 Incoming

Bgthreshold: Determines the actual range of values for the background mask, for example, by:-bgthreshold 32.

Bgfilename: Log all negative samples of the directory file, Xxx/xxx/xxx/neg.txt, for example by:-BG xxx/xxx/xxx/neg.txt incoming

Num: The number of samples to be created, for example by:-num 800 incoming

Invert: Whether inverting or random inversion is required when generating samples from a single picture. For example, by:-INV or-RANDINV, the former invert variable gets a value of 1, the latter invert variable gets a value of 0x7fffffff.

Maxintensitydev: The constant value used to generate the gray value of the foreground (effective pixel area), and the foreground gray value of the actual sample produces a number of different grayscale values based on this parameter combined with random numbers. For example by:-maxidev 220 Incoming

Maxxangle: The maximum radian of the distorted x-axis of the sample picture, which is the rotation of the horizontal direction of the picture. In radians, the default 1.1

Maxyangle: The maximum radian of the distorted y-axis of the sample picture, and the y-axis is the vertical rotation of the picture. In radians, the default 1.1

Maxzangle: The maximum radian of the distortion in the z-axis direction of the sample picture, which is the rotation perpendicular to the orientation of the image plane (understood as the axis of rotation is a vertical line passing through the monitor). In radians, the default is 0.5.

Showsamples: During sample creation, whether each generated sample picture is displayed through Imshow. By:-show to indicate display, no then not displayed

Width: The size of the sample picture to be created, the following training sample step to use the same value as this, otherwise it will be an error, for example by:-W 20来 Specifies the width of the generated positive sample is 20pix

Height: The altitude of the sample image to be created, followed by the training sample step to use the same value as then, otherwise it will be an error, for example, by:-H 20来 Specifies the width of the generated positive sample is 20pix

}//第一个分支elseif( imagename && bgfilename && infoname ){cvCreateTestSamples( infoname, imagename, bgcolor, bgthreshold, bgfilename, num, invert, maxintensitydev,maxxangle, maxyangle, maxzangle, showsamples, width, height );

Create multiple test samples with an incoming single picture Warp warp, and if you pass in a single sample picture path, a negative sample picture path list, and a positive sample path list, walk to this branch:

InfoName: In this branch this is the path list of the generated test sample.

Bgfilename: Background Image Path Description list, using the background image provided here as the background to create a test image. For example, by:-BG Xxx/xxx/neg.txt to pass in

The other parameters are pretty much the same, not here.

}//第二个分支elseif( infoname && vecname ){total = cvCreateTrainingSamplesFromInfo( infoname, vecname,num,showsamples,width,height );

If you do not specify a single picture path, indicate. Create a training sample from a picture list in the description file, and create a positive sample of the training to be saved in the. vec file specified by Vecname:

InfoName: The list manifest file for the positive sample. For example, by:-info Xxx/xxx/xxx/pos.info to pass in.

Other similar to the previous branch, do not repeat

}//第三个分支elseifscale );

If only the Vecname file is specified with a positive sample, the sample picture in the Vec file is displayed:

Scale: Specifies whether the display scales the size of the picture and the scale.

}//第四个分支
Opencv_haartraining.exe parameter explanation

This program calls the following function to train the classifier

cvCreateTreeCascadeClassifier( dirname, vecname, bgname,npos, nneg, nstages, mem,nsplits,minhitrate, maxfalsealarm, weightfraction,mode, symmetric,equalweights, width, height,boosttype, stumperror,maxtreesplits, minpos, bg_vecfile );

This executable program is used to train the classifier, which is located in the call \opencv\build\common directory, and the old version is named Haartraining.exe:

DirName: The directory name passed through the-data, used to store the trained classifier, if there is no training program created by itself.

Vecname: A normal sample set of uniform dimensions generated by the Opencv_createsamples by-vec the incoming positive sample. vec file.

Bgname: A list of negative sample images passed through-BG,

NPOs: The number of positive samples required for each level classifier passed through the-npos.

Nneg: The number of negative samples required for each set of classifiers passed through-nneg can be greater than the number of negative samples listed in the Bgname file manifest.

Nstages: Pass through the-nstages, want to train the class of the classifier, each level is a strong classifier, each strong classifier has a number of weak classifiers.

MEM: The amount of available memory in megabytes that is passed in by-mem. The larger the memory, the faster the training will be.

Nsplits: The number of characteristics of each weak classifier passed through-nsplits (typically 1).

Minhitrate: Passed through-minhitrate, this parameter determines the minimum detection rate for each level of the classifier, by default 0.995. The realization is that each positive sample accumulates the confidence of all weak classifiers of this strong classifier, and then the accumulated confidence of all positive samples is sorted from small to large, because Minhitrate decides at least to minhitrate*npos a positive sample. So the confidence degree of the positive sample of the 1.0-minhitrate *npos is the threshold of the strong classifier, and the threshold value will be divided into positive class, otherwise it is divided into negative class. So minhitrate this value determines the positive rate of the positive sample of each level classifier, the total positive rate is minhitrate^nstages.

Maxfalsealarm: By-maxfalsealarm, it determines the maximum proportion of the sub-negative sample of each strong classifier in the classifier, which determines the number of weak classifiers of the strong classifier. Default 0.5. Its concrete implementation is, the previous through the Minhitrate parameter and the weak classifier's confidence accumulation and, obtained the strong classifier threshold value, through this threshold value to classify negative samples, negative samples of the number of errors can not exceed numneg*maxfalsealarm, If more than continue to train this level of the strong classifier, add new weak classifier until the threshold value of negative sample number is less than numneg*maxfalsealarm to jump out of the loop, the level of the strong classifier training success.

Weightfraction: By-weighttrimming, all samples, including positive and negative samples, are ranked to the lowest weight from small to large in the training of each level of the strong classifier (npos+), before each weak classifier is trained. NNEG) sample to get rid of, because the weight is very small that the sample can always be correctly categorized, delete these have been correctly categorized samples, so that training more focused on the sample is not properly categorized, improve training efficiency. The default is 0.95.

Mode: Passed through-mode, it points out which template Haar features are used for training, there are three enumeration values, Mode==0 represents the original rectangle feature presented by Viola, mode==1 represents all vertical Haar features, and mode==2 represents all features. The default is 0.

Symmetric: Passed-sym or-nonsym, which indicates whether a positive sample is vertically symmetric.

Equalweights: Passed-EQW, if there is-EWQ then the equalweights value is 1. Otherwise, the default is 0. 1 means that all samples have an equal initialization weight and 0 represent unequal.

Width: The width of the positive sample is indicated by the-W Pass
Height: The high of the positive sample is indicated by the-H pass-through

Boosttype: Passed through-BT, divided into four class values {"DAB", "RAB", "LB", "GAB"}: 0-discrete AdaBoost, 1-real AdaBoost, 2-logitboost, 3-gentle AdaBoost represents the type of boost algorithm for 4 applications, which defaults to gab

Stumperror: Passed-err, it points out four computational thresholds for training weak classifiers: 1.misclass 2.gini 3.entropy 4.least sum of squares.

Maxtreesplits: The maximum number of tree nodes that is passed through-maxtreesplits. It is generally 0.

Minpos: The number of positive samples that can be used by the nodes during the training process by passing-minpos. The positive sample is classified according to the node, usually minpos not less than npos/nsplits

Bg_vecfile: Passed through-bg-vecfile, if a parameter-bg-vecfile passed in to indicate that its value is true, then the negative sample is passed in the form of a. vec file, or a negative sample is passed in as a picture path list, which determines the form of reading negative samples.

Thank:::::
http://blog.csdn.net/xidianzhimeng/article/details/10470839
http://blog.csdn.net/xidianzhimeng/article/details/42147601
Http://www.cnblogs.com/chensheng-zhou/p/5542887.html
Http://blog.sina.com.cn/s/blog_5f853eb10100sdgn.html
http://blog.csdn.net/ding977921830/article/details/46723027
http://blog.csdn.net/u011583927/article/details/44892249

AdaBoost Training Parameters Detailed

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.