code: def f1_score(labels, predict, name=None):
      """
      Streaming f1 score.
      """
      predictions = tf.floor(predict + 0.5)
      with tf.variable_scope(name, "f1", (labels, predictions)):
          epsilon = 1e-7
          _, tp = tf.metrics.true_positives(labels, predictions)
          _, fn = tf.metrics.false_negatives(labels, predictions)
          _, fp = tf.metrics.false_positives(labels, predictions)
          precision = tf.div(tp, epsilon + tp + fp, name="precision")
          recall = tf.div(tp, epsilon + tp + fn, name="recall")
          f1 = 2.0 * precision * recall / (precision + recall + epsilon)
      return f1
  
file_path: euler/tf_euler/python/utils/metrics.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import tensorflow
label_desc: Use image node_id 3 for calling a global function with example usage: f1_score(labels, predict, name) and returns: f1