HobbitLong / SupContrast

PyTorch implementation of "Supervised Contrastive Learning" (and SimCLR incidentally)
BSD 2-Clause "Simplified" License
3.12k stars 537 forks source link

about loss_in and loss_out in paper #149

Open hweejuni opened 6 months ago

hweejuni commented 6 months ago

Hello. Thank you for your hard-working! In your paper page 5, you stated that 'The two loss formulations are not, however, equivalent. Because log is a concave function, Jensen’s Inequality [23] implies that L_in ≤ L_out. One would thus expect L_out to be in the superior supervised loss function' this might be a silly question, but I am wondering that why L_in ≤ L_out indicates loss_out is superior loss function ? In your paper page 6, you showed loss_out is more stable for traning and I understood it. But I can't connect this idea with being the superior loss function.

HobbitLong commented 1 month ago

Hi, thanks for the question. Actually the correct loss is actually a simple cross-entropy. Hope this makes it easier to understand