caffe icon indicating copy to clipboard operation
caffe copied to clipboard

how does caffe choose the margin in contrastive loss layer? adaptively?

Open wolfustc opened this issue 11 years ago • 3 comments

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?

wolfustc avatar Jun 16 '15 03:06 wolfustc

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.

amiralush avatar Jun 16 '15 09:06 amiralush

Thanks a lot! But is there an interface for us to set the margin?

wolfustc avatar Jun 16 '15 14:06 wolfustc

This tracker is for issues and bugs with Caffe. Please ask usage and interface questions on the caffe-users list. Thanks!

longjon avatar Jun 19 '15 02:06 longjon