Simple classifier that is 50% certain that the annotation is correct
| 35 | |
| 36 | // Simple classifier that is 50% certain that the annotation is correct |
| 37 | MatrixXf 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 | |
| 54 | int main( int argc, char* argv[]){ |
| 55 | if (argc<4){ |