| 113 | } |
| 114 | } |
| 115 | MatrixXf DenseCRF::inference ( int n_iterations ) const { |
| 116 | MatrixXf Q( M_, N_ ), tmp1, unary( M_, N_ ), tmp2; |
| 117 | unary.fill(0); |
| 118 | if( unary_ ) |
| 119 | unary = unary_->get(); |
| 120 | expAndNormalize( Q, -unary ); |
| 121 | |
| 122 | for( int it=0; it<n_iterations; it++ ) { |
| 123 | tmp1 = -unary; |
| 124 | for( unsigned int k=0; k<pairwise_.size(); k++ ) { |
| 125 | pairwise_[k]->apply( tmp2, Q ); |
| 126 | tmp1 -= tmp2; |
| 127 | } |
| 128 | expAndNormalize( Q, tmp1 ); |
| 129 | } |
| 130 | return Q; |
| 131 | } |
| 132 | VectorXs DenseCRF::map ( int n_iterations ) const { |
| 133 | // Run inference |
| 134 | MatrixXf Q = inference( n_iterations ); |
no test coverage detected