how does caffe choose the margin in contrastive loss layer? adaptively?
The contrastive loss layer takes the following cost function: sum_{i,j in same class} d_ij^2 + sum_{i, j in different classes} max(0,margin-d_ij^2).
Does caffe update the margin during optimization? The answer seems to be not. Then how does caffe choose the margin in advance?
This is indeed an issue. You should choose the margin manually using a verification set or alternately normalize the inputs to be on a unit sphere if that's not the case.
Thanks a lot! But is there an interface for us to set the margin?
This tracker is for issues and bugs with Caffe. Please ask usage and interface questions on the caffe-users list. Thanks!