def accuracy(pred, target):
  """Computes pixel accuracy.

  acc = true_positive / (true_positive + false_positive)

  Args:
    pred: A numpy array.
    target: A numpy array which should be in the same size as pred.

  Returns:
    A number indicating the average accuracy.
  """
  N = pred.shape[0]
  return (pred == target).sum() * 1.0 / N