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

weight in loss computation #5

Closed
zjhthu opened this issue Jun 19, 2024 · 3 comments
Closed

weight in loss computation #5

zjhthu opened this issue Jun 19, 2024 · 3 comments

Comments

@zjhthu
Copy link

zjhthu commented Jun 19, 2024

In the paper, the loss weight for two terms are $\alpha \in [0, 1]$ and $1 - \alpha $, but in the code, the network predicts two weights rather than one, and the loss is in the form logsumexp(weight) - logsumexp(weight - loss), why?

                raw_b = info_predictions[i][:, 2:]
                log_b = torch.zeros_like(raw_b)
                weight = info_predictions[i][:, :2]
                # Large b Component                
                log_b[:, 0] = torch.clamp(raw_b[:, 0], min=0, max=var_max)
                # Small b Component
                log_b[:, 1] = torch.clamp(raw_b[:, 1], min=var_min, max=0)
                # term2: [N, 2, m, H, W]
                term2 = ((flow_gt - flow_predictions[i]).abs().unsqueeze(2)) * (torch.exp(-log_b).unsqueeze(1))
                # term1: [N, m, H, W]
                term1 = weight - math.log(2) - log_b
                nf_loss = torch.logsumexp(weight, dim=1, keepdim=True) - torch.logsumexp(term1.unsqueeze(1) - term2, dim=2)
@MemorySlices
Copy link
Collaborator

We use softmax to obtain the probabilities, similar to image classification.

@NEUzhl
Copy link

NEUzhl commented Aug 6, 2024

?I can not understand

@yanqswhu
Copy link

@zjhthu @NEUzhl you can check my issue to understand these codes #22

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

4 participants