Direct Graphical Models  v.1.7.0
DirectGraphicalModels::CEdgeModelPotts Class Reference

Potts Edge Model for dense graphical models. More...

#include <EdgeModelPotts.h>

Inheritance diagram for DirectGraphicalModels::CEdgeModelPotts:
Collaboration diagram for DirectGraphicalModels::CEdgeModelPotts:

Public Member Functions

 CEdgeModelPotts (const Mat &features, float weight=1.0f, const std::function< void(const Mat &src, Mat &dst)> &semiMetricFunction={}, bool perPixelNormalization=true)
 Constructor. More...
 
virtual ~CEdgeModelPotts (void)=default
 
void apply (const Mat &src, Mat &dst) const override
 Applies an edge model to the node potentials of a dense graph. More...
 
- Public Member Functions inherited from DirectGraphicalModels::IEdgeModel
 IEdgeModel (void)=default
 
 IEdgeModel (const IEdgeModel &)=delete
 
virtual ~IEdgeModel (void)=default
 
const IEdgeModeloperator= (const IEdgeModel &)=delete
 

Private Attributes

std::unique_ptr< CPermutohedral > m_pLattice
 Pointer to the permutohedral lattice. More...
 
float m_weight
 The weighting parameter. More...
 
Mat m_norm
 Array with normalization factors. More...
 
std::function< void(const Mat &src, Mat &dst)> m_function
 The semi-metric function. More...
 

Detailed Description

Potts Edge Model for dense graphical models.

This class implements Potts edge potential model in the fully connected CRF. The implementation is based on Efficient Inference in Fully Connected CRFs with Gaussian Edge Potentials paper.

Author
Sergey G. Kosov, serge.nosp@m.y.ko.nosp@m.sov@p.nosp@m.roje.nosp@m.ct-10.nosp@m..de

Definition at line 17 of file EdgeModelPotts.h.

Constructor & Destructor Documentation

◆ CEdgeModelPotts()

DirectGraphicalModels::CEdgeModelPotts::CEdgeModelPotts ( const Mat &  features,
float  weight = 1.0f,
const std::function< void(const Mat &src, Mat &dst)> &  semiMetricFunction = {},
bool  perPixelNormalization = true 
)

Constructor.

This constucts a new edge potentials model, which is in general training-data-independent, but still contrast-sensitive model (see PhD Thesis Multi-Layer Conditional Random Fields for Revealing Unobserved Entities p. 60 for more details). Test-data-dependency is provided via features argument. However this model might be ''trained'' by using a semimetric function provided via semiMetricFunction argument.

Parameters
featuresThe set of features which correspond to the nodes of the dense graphical model: Mat(size: nNodes x nFeatures; type: CV_32FC1)
weightThe weighting parameter (default value is 1)
semiMetricFunctionReference to a semi-metric function, which arguments src and dst are: Mat(size: 1 x nFeatures; type: CV_32FC1). This function when provided will be called for every node potential in the apply() method.
perPixelNormalizationFlag indicating whether er-pixel normalization should be used during applying the edge model.

Definition at line 5 of file EdgeModelPotts.cpp.

◆ ~CEdgeModelPotts()

virtual DirectGraphicalModels::CEdgeModelPotts::~CEdgeModelPotts ( void  )
virtualdefault

Member Function Documentation

◆ apply()

void DirectGraphicalModels::CEdgeModelPotts::apply ( const Mat &  src,
Mat &  dst 
) const
overridevirtual

Applies an edge model to the node potentials of a dense graph.

This function subsequently (in terms of multiple iterations and multiple models) applies an edge model derived from this class to the node potentials provided via src argument and stores the result into the dst.

Parameters
[in]srcThe dense graph node potentials in form Mat(size: nNodes x nStates; type: CV_32FC1)
[out]dstThe reference to the container for resulting node potentials. Resulting matrix will be the same size and type as the input one: Mat(size: nNodes x nStates; type: CV_32FC1)

Implements DirectGraphicalModels::IEdgeModel.

Definition at line 28 of file EdgeModelPotts.cpp.

Member Data Documentation

◆ m_function

std::function<void(const Mat &src, Mat &dst)> DirectGraphicalModels::CEdgeModelPotts::m_function
private

The semi-metric function.

Definition at line 41 of file EdgeModelPotts.h.

◆ m_norm

Mat DirectGraphicalModels::CEdgeModelPotts::m_norm
private

Array with normalization factors.

Definition at line 40 of file EdgeModelPotts.h.

◆ m_pLattice

std::unique_ptr<CPermutohedral> DirectGraphicalModels::CEdgeModelPotts::m_pLattice
private

Pointer to the permutohedral lattice.

Definition at line 38 of file EdgeModelPotts.h.

◆ m_weight

float DirectGraphicalModels::CEdgeModelPotts::m_weight
private

The weighting parameter.

Definition at line 39 of file EdgeModelPotts.h.


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