I am training a simple siamese network that compares a pair of images. I followed the example given with the caffe(siamese) and made my own model.
My issue is with the Constrastive Loss function. The detail of this function implementation is caffe is defined here. In my implementation I used a margin = 1, defined as follows
layer {
name: "loss"
type: "ContrastiveLoss"
bottom: "data"
bottom: "data_p"
bottom: "label"
top: "loss"
contrastive_loss_param {
margin: 1
}
}
My data are labeled as 0 if dissimliar and 1 if similar. I am confused about the margin of contrastive loss function. How is the margin parameter selected?
Page 3 of the initial paper by Hadsell et.al states margin > 0 but is there any upper bound?