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

adv_loss keep increasing during training? #96

Open
VE-yyq opened this issue Jan 12, 2021 · 2 comments
Open

adv_loss keep increasing during training? #96

VE-yyq opened this issue Jan 12, 2021 · 2 comments

Comments

@VE-yyq
Copy link

VE-yyq commented Jan 12, 2021

I just set lambda-adv-target1 as 0.00 and lambda-adv-target2 as 0. 001 to train the single-level model. All parameters are the same as those set by the author. But I find that adv_loss keep increasing while others decreasing during training. I suppose that the adv_loss should decrease according to the code below, right? Could you help me to find out what the problem is? @wasidennis Looking forward to your reply. Thank you:)

`

        _, batch = targetloader_iter.__next__()
        images, _, _ = batch
        images = images.to(device)

        pred_target1, pred_target2 = model(images)
        pred_target1 = interp_target(pred_target1)
        pred_target2 = interp_target(pred_target2)

        D_out1 = model_D1(F.softmax(pred_target1))
        D_out2 = model_D2(F.softmax(pred_target2))

        loss_adv_target1 = bce_loss(D_out1, torch.FloatTensor(D_out1.data.size()).fill_(source_label).to(device))

        loss_adv_target2 = bce_loss(D_out2, torch.FloatTensor(D_out2.data.size()).fill_(source_label).to(device))

        loss = args.lambda_adv_target1 * loss_adv_target1 + args.lambda_adv_target2 * loss_adv_target2
        loss = loss / args.iter_size
        loss.backward()`

image
image

@wasidennis
Copy link
Owner

@VE-yyq The adversarial loss is supposed to increase in the min-max optimization, while the loss for the discriminator needs to decrease. The trend in your log is correct.

@dabblle
Copy link

dabblle commented Mar 17, 2021

@VE-yyq 可以分享一下您的完整训练曲线嘛?我邮箱[email protected]

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

3 participants