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 issue in RegL1Loss #693

Closed
wants to merge 1 commit into from
Closed

loss issue in RegL1Loss #693

wants to merge 1 commit into from

Conversation

JavisPeng
Copy link

def forward(self, output, mask, ind, target):
    pred = _transpose_and_gather_feat(output, ind)
    mask = mask.unsqueeze(2).expand_as(pred).float()
    # loss = F.l1_loss(pred * mask, target * mask, reduction='elementwise_mean')
    loss = F.l1_loss(pred * mask, target * mask, size_average=False)
    loss = loss / (mask.sum() + 1e-4)
    return loss

since the mask has expanded, the number of value 1 should be twice the previous, which results in loss=loss*0.5

@xingyizhou
Copy link
Owner

Thank you for your contribution. However this will impact the performance and needs further verification. Closing it for now.

@xingyizhou xingyizhou closed this May 13, 2020
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

Successfully merging this pull request may close these issues.

2 participants