MCPcopy Create free account
hub / github.com/HiLab-git/SimpleCRF / initLattice

Method initLattice

dependency/densecrf3d/src/pairwise.cpp:40–63  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38 MatrixXf f_;
39 MatrixXf parameters_;
40 void initLattice( const MatrixXf & f ) {
41
42 const int N = f.cols();
43 lattice_.init( f );
44
45 norm_ = lattice_.compute( VectorXf::Ones( N ).transpose() ).transpose();
46
47 if ( ntype_ == NO_NORMALIZATION ) {
48 float mean_norm = 0;
49 for ( int i=0; i<N; i++ )
50 mean_norm += norm_[i];
51 mean_norm = N / mean_norm;
52 for ( int i=0; i<N; i++ )
53 norm_[i] = mean_norm;
54 }
55 else if ( ntype_ == NORMALIZE_SYMMETRIC ) {
56 for ( int i=0; i<N; i++ )
57 norm_[i] = 1.0 / sqrt(norm_[i]+1e-20);
58 }
59 else {
60 for ( int i=0; i<N; i++ )
61 norm_[i] = 1.0 / (norm_[i]+1e-20);
62 }
63 }
64 void filter( MatrixXf & out, const MatrixXf & in, bool transpose ) const {
65 // Read in the values
66 if( ntype_ == NORMALIZE_SYMMETRIC || (ntype_ == NORMALIZE_BEFORE && !transpose) || (ntype_ == NORMALIZE_AFTER && transpose))

Callers

nothing calls this directly

Calls 5

sqrtFunction · 0.50
colsMethod · 0.45
initMethod · 0.45
transposeMethod · 0.45
computeMethod · 0.45

Tested by

no test coverage detected