Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

About ContaGan 2C loss #85

Closed
WuDiDaBinGe opened this issue Sep 25, 2021 · 4 comments
Closed

About ContaGan 2C loss #85

WuDiDaBinGe opened this issue Sep 25, 2021 · 4 comments

Comments

@WuDiDaBinGe
Copy link

image
this is 2c Loss, when i watch the code, i found the 2c loss code multiply a extra temperature.
denomerator = torch.cat([torch.unsqueeze(inst2proxy_positive, dim=1), instance_zone], dim=1).sum(dim=1)
criterion = -torch.log(temperature * (numerator / denomerator)).mean()

@mingukkang
Copy link
Collaborator

Hi,

The additional temperature (t) is multiplied for a balance between adversarial training and class conditioning.

However, as you can see in src/configs, all temperatures in ContraGAN.json are fixed at 1.0.

Sorry for the late reply.

Thank you.

@WuDiDaBinGe
Copy link
Author

Thanks for you repling. But i still don't understand.
I don't know why use temperature to balance adversarial training and class conditioning.
gen_acml_loss += self.contrastive_lambda*self.contrastive_criterion(cls_embed_fake, cls_proxies_fake, fake_cls_mask, fake_labels, t, self.margin)
did't this value (contrastive_lambda i ) already balanced them?

@mingukkang
Copy link
Collaborator

mingukkang commented Oct 16, 2021

Hello.

I noticed that multiplying both the temperature and self.contrastive_lambda is redundant.

I will revise the code in the main branch (actually it is already reflected in the renew_cfgs branch (worker.py line 293), which will officially be released at the end of this month).

Thank you.

@WuDiDaBinGe
Copy link
Author

OK.Thanks a lot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants