scuwyh2000 / RandBox

[ICCV 2023] PyTorch implementation of RandBox
http://arxiv.org/abs/2307.08249
52 stars 5 forks source link

loss_nc_labels loss function does not make any sense #23

Open skbhat opened 6 months ago

skbhat commented 6 months ago

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