def contrastive_loss(y_true, y_pred):
    margin = 1
    return K.mean(y_true * K.square(y_pred) + (1 - y_true) * K.square(K.maximum(margin - y_pred, 0)))
Contrastive loss from Hadsell-et-al.'06
dataset/ETHPy150Open fchollet/keras/examples/mnist_siamese_graph.py/contrastive_loss