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_nc_labels loss function does not make any sense #23

Open
skbhat opened this issue May 22, 2024 · 0 comments
Open

loss_nc_labels loss function does not make any sense #23

skbhat opened this issue May 22, 2024 · 0 comments

Comments

@skbhat
Copy link

skbhat commented May 22, 2024

Namaste,

This is regarding function loss_nc_labels

Whatever computed till line 183 is not used for further computation at all. Then in line 186 the variable target_classes_onehot is defined as follows:

target_classes_onehot = torch.zeros([src_logits.shape[0], src_logits.shape[1], self.num_classes + 1], ...)
target_classes_onehot.scatter_(2, target_classes.unsqueeze(-1), 1)
target_classes_onehot = target_classes_onehot[:, :, :-1]

Since the target_classes for the unknown class is always self.num_classes, this means that target_classes_onehot will always be full of zeros. No matter what is the ground truth or what is the predicted class confidences, this code will make the target of the output logits to zero.

Can anyone explain where I am going wrong? I am not using fed_loss.

Thanks

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

1 participant