Public Member Functions | Static Public Attributes | Friends

FeatureRegressor2 Class Reference
[Auxilliary Tools]

Auxilliary Tool: A data structure that learns a non-linear tuning curve for mapping feature outputs to image labels. This is the "weak learner" used by GentleBoost. More...

#include <FeatureRegressor2.h>

Collaboration diagram for FeatureRegressor2:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FeatureRegressor2 ()
 Default Constructor.
void setFeature (const Feature2 *feature)
 Set feature. Must call train again after setting feature.
 FeatureRegressor2 (const Feature2 *feature)
 Constructor.
 ~FeatureRegressor2 ()
 Destructor.
 FeatureRegressor2 (const FeatureRegressor2 &copy)
 Copy Constructor.
FeatureRegressor2operator= (const FeatureRegressor2 &rhs)
 Assignment operator.
void train (int numTableElements, const std::vector< ImagePatch2 > &patches, const cv::Mat &labels, const cv::Mat &dataWeights)
 Train the regression model with data.
void predict (const std::vector< ImagePatch2 > &patches, cv::Mat &scalarVals) const
 Try to predict whether new ImagePatch data are the object we're trying to detect.
void predictPatchList (PatchList2 *patches) const
 Try to predict whether a set of patches corresponding to image locations are the object. This is used for efficiently searching through a whole image for the object.
void applyLUTToImage (cv::Mat &image) const
 Assuming all patches in an image were filtered with the feature, this will make a prediction for each pixel as to whether it is the top left corner of the trained object. Modifies the input image.
void combineLUTs (const FeatureRegressor2 &other)
 Combine predictions from two regressors. This can be used to "boost" the confidence of a single feature in a computationally efficient way.
double getLUTRange () const
 Gets the range of feature values computed during training (max-min). This can be useful for detecting degenerate features that produce extremely small ranges of values.
Feature2getFeature () const
 Get the feature that this FeatureRegressor was created with. This returns the actual feature object used by the regressor, which is a copy of the one it was trained with.
cv::Size getFeaturePatchSize () const
 Get the patch size of the FeatureRegressor's Feature.

Static Public Attributes

static double TAU = .05
 Window-Size regularization Parameter.
static double EPS = .001
 No-Evidence regularization Parameter.

Friends

cv::FileStorage & operator<< (cv::FileStorage &fs, const FeatureRegressor2 &reg)
 Write to a file.
void operator>> (const cv::FileNode &fs, FeatureRegressor2 &reg)
 Read from a file.

Detailed Description

Auxilliary Tool: A data structure that learns a non-linear tuning curve for mapping feature outputs to image labels. This is the "weak learner" used by GentleBoost.

A FeatureRegressor is initialized with a feature. It must then be trained, using a set of image patches, labels indicating whether the image patches are positive or negative examples (-1 for negative, +1 for positive), and weights for each example, which specify how much the learner should care about getting the answer of that example correct, relative to the other examples.

Two regularization parameters control the behavior of the feature regressor: TAU describes the window-of-influence of each example, and can range from (0-1], with a default of 0.05. EPS describes what happens in regions with no data. If EPS is high, the classifier will revert to the mean label in regions with no data. If EPS is 0, the classifier will use the label of the nearest point. The default is 0.001. Since these are regularization parameters, it doesn't make sense to tune them on an individual basis. Therefore, they are static variables.

Author:
Nicholas Butko
Date:
2010
Version:
0.4

Constructor & Destructor Documentation

FeatureRegressor2::FeatureRegressor2 ( const Feature2 feature )

Constructor.

Parameters:
featureThe feature that transforms ImagePatch data into a scalar value.

Member Function Documentation

void FeatureRegressor2::applyLUTToImage ( cv::Mat &  image ) const

Assuming all patches in an image were filtered with the feature, this will make a prediction for each pixel as to whether it is the top left corner of the trained object. Modifies the input image.

Parameters:
imagePrecondition: contains the filter outputs at each point in the image. Postcondition: contains the prediction (in -1:1) about whether the top-left of the object is located at each pixel.
void FeatureRegressor2::combineLUTs ( const FeatureRegressor2 other )

Combine predictions from two regressors. This can be used to "boost" the confidence of a single feature in a computationally efficient way.

Parameters:
otherAnother FeatureRegressor, trained with either different data, or a different weighting, but that has the same base feature.
Feature2 * FeatureRegressor2::getFeature (  ) const

Get the feature that this FeatureRegressor was created with. This returns the actual feature object used by the regressor, which is a copy of the one it was trained with.

return The actual feature object of the regressor.

cv::Size FeatureRegressor2::getFeaturePatchSize (  ) const

Get the patch size of the FeatureRegressor's Feature.

Returns:
Base patch size for this regressor.
double FeatureRegressor2::getLUTRange (  ) const

Gets the range of feature values computed during training (max-min). This can be useful for detecting degenerate features that produce extremely small ranges of values.

Returns:
The range of feature values computed during training (max-min).
void FeatureRegressor2::predict ( const std::vector< ImagePatch2 > &  patches,
cv::Mat &  scalarVals 
) const

Try to predict whether new ImagePatch data are the object we're trying to detect.

Parameters:
patchesThe image patches that are or are not examples of the class of interest.
scalarValsA graded confidence that the patch is or is not the object of interest (set by the algorithm), ranging from +1 (sure that it is the object) through 0 (completely unsure) to -1 (sure that it's not an instance of the object). If the provided CvMat is NULL or has inappropriate size, it will be freed and recreated.
void FeatureRegressor2::predictPatchList ( PatchList2 patches ) const

Try to predict whether a set of patches corresponding to image locations are the object. This is used for efficiently searching through a whole image for the object.

Parameters:
patchesCandidate locations in the image where it is thought the object may be. The results are stored in the PatchList data structure.
void FeatureRegressor2::train ( int  numTableElements,
const std::vector< ImagePatch2 > &  patches,
const cv::Mat &  labels,
const cv::Mat &  dataWeights 
)

Train the regression model with data.

Parameters:
numTableElementsThe learned tuning curve is discretized into a number of discrete bins, based on the range of feature outputs observed in training. A reasonable number of bins is 100.
patchesThe image patches that are or are not examples of the class of interest.
labelsLabels indicating whether each patch is or isn't the object we're trying to detect, +1 means yes, -1 means no.
dataWeightsSpecify how much the learner should care about getting the answer of that example correct, relative to the other examples.

Member Data Documentation

double FeatureRegressor2::EPS = .001 [static]

No-Evidence regularization Parameter.

EPS describes what happens in regions with no data. If EPS is high, the classifier will revert to the mean label in regions with no data. If EPS is 0, the classifier will use the label of the nearest point. The default is 0.001.

double FeatureRegressor2::TAU = .05 [static]

Window-Size regularization Parameter.

TAU describes the window-of-influence of each example, and can range from (0-1], with a default of 0.05.


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