code: def accuracy_binary(normalized_preds, labels, threshold=0.5):
      """Accuracy with probabilities for binary classification."""
      predictions = tf.greater_equal(normalized_preds, threshold)
      labels = tf.cast(labels, tf.bool)
      accuracy = tf.cast(tf.equal(predictions, labels), tf.float32)
      return tf.reduce_mean(accuracy)
  
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import collections
  import logging
  import os
  from ..data.preprocessing import split_train_val
  import numpy
  import tensorflow
  from .trainer_base import batch_iterator
  from .trainer_base import Trainer
label_desc: Use image node_id 1 for calling a global function with example usage: accuracy_binary(normalized_preds, labels, threshold) and returns: tf