code: def binary_accuracy(y_true, y_pred, threshold=0.5):
      y_true = ops.convert_to_tensor(y_true)
      y_pred = ops.convert_to_tensor(y_pred)
      y_true, y_pred = squeeze_to_same_rank(y_true, y_pred)
      threshold = ops.cast(threshold, y_pred.dtype)
      y_pred = ops.cast(y_pred > threshold, y_true.dtype)
      return ops.mean(
          ops.cast(ops.equal(y_true, y_pred), dtype=backend.floatx()),
          axis=-1,
      )
  
imports: from keras import backend
  from keras import ops
  from keras.api_export import keras_export
  from keras.losses.loss import squeeze_to_same_rank
  from keras.metrics import reduction_metrics
label_desc: Use image node_id 2 for calling a global function with example usage: binary_accuracy(y_true, y_pred, threshold) and returns: ops