Public Member Functions | Static Public Attributes | Friends

FeatureRegressor 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 <FeatureRegressor.h>

Collaboration diagram for FeatureRegressor:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 FeatureRegressor ()
 Default Constructor.
void setFeature (const Feature *feature)
 Set feature. Must call train again after setting feature.
 FeatureRegressor (const Feature *feature)
 Constructor.
 ~FeatureRegressor ()
 Destructor.
 FeatureRegressor (const FeatureRegressor &copy)
 Copy Constructor.
FeatureRegressoroperator= (const FeatureRegressor &rhs)
 Assignment operator.
void train (int numTableElements, const std::vector< ImagePatch * > &patches, const cv::Mat &labels, const cv::Mat &dataWeights)
 Train the regression model with data.
void train (int numTableElements, const std::vector< ImagePatch > &patches, const cv::Mat &labels, const cv::Mat &dataWeights)
 Train the regression model with data.
void predict (const std::vector< ImagePatch > patches, cv::Mat &scalarVals) const
 Try to predict whether new ImagePatch data are the object we're trying to detect.
void predict (const std::vector< ImagePatch * > patches, cv::Mat &scalarVals) const
 Try to predict whether new ImagePatch data are the object we're trying to detect.
void predict (const std::vector< ImagePatch > &patches, std::vector< double > &scalarVals) const
 Try to predict whether new ImagePatch data are the object we're trying to detect.
void predict (const std::vector< ImagePatch * > &patches, std::vector< double > &scalarVals) const
 Try to predict whether new ImagePatch data are the object we're trying to detect.
void predictPatchList (PatchList *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 FeatureRegressor *other)
 Combine predictions from two regressors. This can be used to "boost" the confidence of a single feature in a computationally efficient way.
void combineLUTs (const FeatureRegressor &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.
FeaturegetFeature () 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

std::ostream & operator<< (std::ostream &ofs, const FeatureRegressor *reg)
 Write to a file.
std::ostream & operator<< (std::ostream &ofs, const FeatureRegressor &reg)
 Write to a file.
std::istream & operator>> (std::istream &ifs, FeatureRegressor *&reg)
 Read from a file.
std::istream & operator>> (std::istream &ifs, FeatureRegressor &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

FeatureRegressor::FeatureRegressor ( const Feature feature )

Constructor.

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

Member Function Documentation

void FeatureRegressor::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 FeatureRegressor::combineLUTs ( const FeatureRegressor 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.
void FeatureRegressor::combineLUTs ( const FeatureRegressor 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.
Feature * FeatureRegressor::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 FeatureRegressor::getFeaturePatchSize (  ) const

Get the patch size of the FeatureRegressor's Feature.

Returns:
Base patch size for this regressor.
double FeatureRegressor::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 FeatureRegressor::predict ( const std::vector< ImagePatch 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 FeatureRegressor::predict ( const std::vector< ImagePatch * > &  patches,
std::vector< double > &  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)
void FeatureRegressor::predict ( const std::vector< ImagePatch > &  patches,
std::vector< double > &  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)
void FeatureRegressor::predict ( const std::vector< ImagePatch * >  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 FeatureRegressor::predictPatchList ( PatchList 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 FeatureRegressor::train ( int  numTableElements,
const std::vector< ImagePatch * > &  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.
void FeatureRegressor::train ( int  numTableElements,
const std::vector< ImagePatch > &  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 FeatureRegressor::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 FeatureRegressor::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: