Tensorflow, multi label accuracy calculation
<p>I am working on a multi label problem and i am trying to determine the accuracy of my model.</p>

<p>My model:</p>

<pre class="lang-py prettyprint-override"><code>NUM_CLASSES = 361

x = tf.placeholder(tf.float32, [None, IMAGE_PIXELS])
y_ = tf.placeholder(tf.float32, [None, NUM_CLASSES])

# create the network
pred = conv_net( x )

# loss
cost = tf.reduce_mean( tf.nn.sigmoid_cross_entropy_with_logits( pred, y_) )

# train step
train_step   = tf.train.AdamOptimizer().minimize( cost )
</code></pre>

<p>i want to calculate the accuracy in two different ways<br>
- % of all labels that are predicted correctly
- % of images where ALL labels are predicted correctly</p>

<p>unfortunately i am only able to calculate the % of all labels that are predicted correctly. </p>

<p>I thought this code would calculate % of images where ALL labels are predicted correctly</p>

<pre class="lang-py prettyprint-override"><code>correct_prediction = tf.equal( tf.round( pred ), tf.round( y_ ) )

accuracy = tf.reduce_mean(tf.cast(correct_prediction, tf.float32))
</code></pre>

<p>and this code % of all labels that are predicted correctly</p>

<pre class="lang-py prettyprint-override"><code>pred_reshape = tf.reshape( pred, [ BATCH_SIZE * NUM_CLASSES, 1 ] )
y_reshape = tf.reshape( y_, [ BATCH_SIZE * NUM_CLASSES, 1 ] )

correct_prediction_all = tf.equal( tf.round( pred_reshape ), tf.round( y_reshape ) )

accuracy_all = tf.reduce_mean( tf.cast(correct_prediction_all, tf.float32 ) )
</code></pre>

<p>somehow the coherency of the labels belonging to one image is lost and i am not sure why.</p>