Closed pvskand closed 7 years ago
Aah I realised my mistake.
return T.mean(y * d + (1.0 - y) * T.maximum(margin - d, 0.0))
is for having two similar features having the value 0 and return T.mean((1.0 - y) * d + y * T.maximum(margin - d, 0.0))
is for having 2 dissimilar features to give a value near to 0.
My bad! Closing this issue!
In the
siamese_net.py
in thecontrastive_loss
function I think the definition of the loss is implemented wrong.The output of the function is the following:
return T.mean(y * d + (1.0 - y) * T.maximum(margin - d, 0.0))
but according to the paper, if you see page 3 (bottom) according to the definition, the output must be:return T.mean((1.0 - y) * d + y * T.maximum(margin - d, 0.0))