PedestrainCounting
Public Member Functions | List of all members
ClassifierSelector Class Reference

#include <ClassifierSelector.h>

Public Member Functions

 ClassifierSelector (int numW, const Size &patchSize, int numB=2)
 
 ClassifierSelector (int numW, WeakClassifier **weaks, int numB=2)
 
void Initialize (const Size &patchSize)
 
void Train (const IntegralImage *intImage, const Rect &roi, int target, float importance, bool *errMask)
 
float GetError (int index=-1) const
 
virtual int SelectBestClassifer (float importance, const bool *errorMask, float *errors)
 
virtual int ReplaceWeakestClassifier (float *sumErrors, const Size &patchSize)
 
virtual void ReplaceWeakestClassifierStatistic (int src, int dst)
 
int Classify (const IntegralImage *intImage, const Rect &roi)
 
float Evaluate (const IntegralImage *intImage, const Rect &roi, int indexWeak=-1)
 
WeakClassifier ** GetClassifierPool () const
 
void SetClassifierPool (WeakClassifier **weaks)
 
int GetNewBackup ()
 

Detailed Description

Select the best classifier from some weak classifiers. Here we only use WeakClassifierHaar. Used in online boosting classifier.

Author
Zhengrong Wang.

Constructor & Destructor Documentation

ClassifierSelector::ClassifierSelector ( int  numW,
const Size patchSize,
int  numB = 2 
)

Build a classifier selector with some WeakClassifierHaars.

Parameters
numW# weak classifiers
patchSizethe patch size used in weak classifiers
numB# weak classifiers for subsititution
ClassifierSelector::ClassifierSelector ( int  numW,
WeakClassifier **  weaks,
int  numB = 2 
)

Build a classifier selector from some outside weakclassifier array.

Parameters
weaksthe array of weak classifiers.

Member Function Documentation

int ClassifierSelector::Classify ( const IntegralImage intImage,
const Rect roi 
)

Evaluate a feature.

Returns
1 for pos, -1 for neg
float ClassifierSelector::GetError ( int  index = -1) const
Returns
the error rate of this seletor, or any specific classifier.
void ClassifierSelector::Initialize ( const Size patchSize)

Initialize this selector for a new target. Notice the number of weak classifiers will not change, but all the features will be randomly generated again. This is designed to reduce the new/delete operation.

int ClassifierSelector::ReplaceWeakestClassifier ( float *  sumErrors,
const Size patchSize 
)
virtual

Replace the weakest classifier.

Parameters
sumErrorsa buffer contains the sum of error rate. The biggest weak classifier will be replaced
Returns
the index of the replaced classifier
void ClassifierSelector::ReplaceWeakestClassifierStatistic ( int  src,
int  dst 
)
virtual

Only replace the weight. Used when the weak classifier is from outside.

int ClassifierSelector::SelectBestClassifer ( float  importance,
const bool *  errorMask,
float *  errors 
)
virtual

Select the best classifier.

Parameters
inimportance the weight of this sample
inerrorMask true if the classifer makes mistake on this sample
outerrors a buffer contains the error rates of each classifier
Returns
index of new selected classifier
void ClassifierSelector::Train ( const IntegralImage intImage,
const Rect roi,
int  target,
float  importance,
bool *  errMask 
)

Train the weak classifiers.

Parameters
intImagethe integral image
roithe region of the target
target1 for pos, -1 for neg
importancethe weight of this sample
outerrMask update the error mask array

The documentation for this class was generated from the following files: