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

Function computeUnary

dependency/densecrf/examples/dense_inference.cpp:37–52  ·  view source on GitHub ↗

Simple classifier that is 50% certain that the annotation is correct

Source from the content-addressed store, hash-verified

35
36// Simple classifier that is 50% certain that the annotation is correct
37MatrixXf computeUnary( const VectorXs & lbl, int M ){
38 const float u_energy = -log( 1.0 / M );
39 const float n_energy = -log( (1.0 - GT_PROB) / (M-1) );
40 const float p_energy = -log( GT_PROB );
41 MatrixXf r( M, lbl.rows() );
42 r.fill(u_energy);
43 //printf("%d %d %d \n",im[0],im[1],im[2]);
44 for( int k=0; k<lbl.rows(); k++ ){
45 // Set the energy
46 if (lbl[k]>=0){
47 r.col(k).fill( n_energy );
48 r(lbl[k],k) = p_energy;
49 }
50 }
51 return r;
52}
53
54int main( int argc, char* argv[]){
55 if (argc<4){

Callers 1

mainFunction · 0.70

Calls 4

logFunction · 0.50
rowsMethod · 0.45
fillMethod · 0.45
colMethod · 0.45

Tested by

no test coverage detected