Darwin  1.10(beta)
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
drwnPixelSegModel Class Reference

Implements a pixel-level CRF model for multi-class image segmentation (pixel labeling). More...

Inheritance diagram for drwnPixelSegModel:
drwnWriteable drwnTypeable

Public Member Functions

 drwnPixelSegModel ()
 default constructor
 
 drwnPixelSegModel (const drwnPixelSegModel &model)
 copy constructor
 
const char * type () const
 returns object type as a string (e.g., Foo::type() { return "Foo"; })
 
virtual void clear ()
 clear learned model parameters
 
virtual bool save (drwnXMLNode &xml) const
 write object to XML node (see also write)
 
virtual bool load (drwnXMLNode &xml)
 read object from XML node (see also read)
 
int numLabels () const
 return the number of labels that this model has been trained to recognize
 
void setFeatureGenerator (const drwnSegImagePixelFeatures &featureGenerator)
 set the object used to generate pixel features from the image instance
 
const drwnSegImagePixelFeaturesgetFeatureGenerator () const
 return the object used to generate pixel features from the image instance
 
void learnTrainingClassWeights (const vector< string > &baseNames)
 learn the training class weights by counting class occurrance
 
void learnBoostedPixelModels (const vector< string > &baseNames, int subSample=0)
 learn boosted classifiers for predicting classes from pixel features
 
void learnPixelUnaryModel (const vector< string > &baseNames, int subSample=0)
 learn unary potentials for calibrating pixel predictions
 
void learnPixelContrastWeight (const vector< string > &baseNames)
 learn the weight of the pairwise constrast term
 
void learnPixelContrastWeight (double weight)
 set the weight of the pairwise contrast term
 
void learnLongRangePairwiseWeight (const vector< string > &baseNames, double threshold, unsigned radius=4)
 learn the weight of the long range pairwise term
 
void learnLongRangePairwiseWeight (double weight, double threshold, unsigned radius=4)
 set the weight of the long range pairwise term
 
void learnRobustPottsWeight (const vector< string > &baseNames)
 learn the weight of the robust potts consistency term
 
void learnRobustPottsWeight (double weight)
 set the weight of the robust potts consistency term
 
void learnPixelContrastAndRobustPottsWeights (const vector< string > &baseNames)
 learn the weights of the pairwise contrast and robust potts consistency terms jointly
 
void learnPixelContrastAndLongRangeWeights (const vector< string > &baseNames, double threshold, unsigned radius=4)
 learn the contrast and long-range weights jointly
 
double getPairwiseContrastWeight () const
 get the weight of the pairwise contrast term
 
double getLongRangePairwiseWeight () const
 get the weight of the long range pairwise term
 
double getRobustPottsWeight () const
 get the weight of the robust potts term
 
void cacheUnaryPotentials (drwnSegImageInstance *instance) const
 cache the unary potentials inside the instance object
 
void cacheLongRangeEdges (drwnSegImageInstance *instance) const
 cache the long-range edges inside the instance object
 
double inferPixelLabels (drwnSegImageInstance *instance) const
 infer the pixel labels using learned model parameters and store the predicted labels inside the instance object
 
virtual double inferPixelLabels (const vector< string > &baseNames, vector< MatrixXi > &predictedLabels) const
 infer pixel labels for a set of images and return predicted labels in predictedLabels
 
virtual double energy (drwnSegImageInstance *instance) const
 return the energy of a given labeling according to the model parameters
 
- Public Member Functions inherited from drwnWriteable
bool write (const char *filename) const
 write object to file (calls save)
 
bool read (const char *filename)
 read object from file (calls load)
 
void dump () const
 print object's current state to standard output (for debugging)
 

Protected Member Functions

void computeBoostedResponses (const vector< double > &x, vector< double > &y) const
 compute boosted pixel features y as a function of raw features x
 
void cacheBoostedPixelResponses (drwnSegImageInstance &instance) const
 cache all boosted pixel features in instance More...
 
void buildSampledTrainingSet (const vector< string > &baseNames, const char *labelExt, int nLabels, vector< vector< double > > &featureVectors, vector< int > &featureLabels, int subSample, bool bRawFeatures) const
 dataset creation for training
 
void crossValidateWeights (const vector< string > &baseNames, const vector< double > &pairwiseContrastValues, const vector< double > &robustPottsValues, const vector< double > &longRangeValues)
 cross-validate pairwise contrast and robust potts weights
 

Protected Attributes

drwnSegImagePixelFeatures_featureGenerator
 pixel feature generator
 
vector< double > _classTrainingWeights
 class training weights (normalized to sum to one)
 
vector< drwnBoostedClassifier * > _pixelClassModels
 boosted pixel classifiers for generating pixel features (if boosted pixel classifiers are not learned then the multi-class logistic is run on the raw features)
 
drwnFeatureWhitener _pixelFeatureWhitener
 feature whitener for unary model
 
drwnTMultiClassLogistic< drwnBiasJointFeatureMap_pixelUnaryModel
 pixelwise unary model
 
double _pixelContrastWeight
 weight for pairwise constrast-dependent smoothness term
 
double _longRangeEdgeWeight
 weight for (long range) auxiliary edges
 
unsigned _longRangeMatchRadius
 radius for long range edge match
 
double _longRangeEdgeThreshold
 percentage of long range edges to include
 
double _robustPottsWeight
 weight for robust potts consistency term
 

Detailed Description

Implements a pixel-level CRF model for multi-class image segmentation (pixel labeling).

The model supports a contrast-sensitive pairwise smoothness prior, long range pairwise terms determined from patch matching, and a higher-order robust generalized potts consistency prior. The pairwise smoothness prior is defined over an 8-connected neighbourhood for each pixel. The robust potts prior is implemented on the superpixels defined in each drwnSegImageInstance.

See also
drwnSegImageInstance
Multi-class Image Segmentation

Member Function Documentation

◆ cacheBoostedPixelResponses()

void drwnPixelSegModel::cacheBoostedPixelResponses ( drwnSegImageInstance instance) const
protected

cache all boosted pixel features in instance

Todo:
refactor using persistent storage class

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