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