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

Loss weights for non-ofg process #16

Open
busyyang opened this issue Jul 11, 2024 · 1 comment
Open

Loss weights for non-ofg process #16

busyyang opened this issue Jul 11, 2024 · 1 comment
Labels
question Further information is requested

Comments

@busyyang
Copy link

Hi, I just find an issue about the loss weights when ofg_epoch=0:

  • When do ofg, the loss_ofg and loss_reg is added with weights.
if ofg_epoch:
                '''use ofg loss'''
                ofg_lr = calc_learning_rate(epoch, max_epoch, args.ofg_lr)
                criterion_ofg = OFGLoss(iter_count=ofg_epoch, reg_weight=weights_opt[1], lr=ofg_lr)

                loss_ofg = criterion_ofg(x, y, output[1]) * weights_model[0]    # <-------- with weights
                loss_reg = criterion_reg(output[1]) * weights_model[1]          # <-------- with weights
                loss = loss_ofg + loss_reg
                loss_vals = [loss_ofg, loss_reg]
  • When ofg_epoch=0, the loss_ncc and loss_reg are added without weights?
else:
                '''use ncc loss'''
                loss_ncc = criterion_ncc(output[0], y)    # <-------- without weights
                loss_reg = criterion_reg(output[1])       # <-------- without weights
                loss = loss_ncc + loss_reg
                loss_vals = [loss_ncc, loss_reg]

Is there a bug when without OFG?

@yuelinxin
Copy link
Contributor

No because the default weight for unsupervised loss, i.e., NCC + regularization, is 1 : 1, so no weight is needed there. For OFG, we have OFG:Reg = 1:0.02, so there is a weight involved.

@yuelinxin yuelinxin added the question Further information is requested label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants