Skip to content

There is a bug in final_classifier.py #32

Description

@Bingyang0410

In this line 291:
per_class_accuracies[i] = torch.div((predicted_label[is_class]==test_label[is_class]).sum().float(),is_class.sum().float())

if the output have some NaN value, the output of the accuracy maybe Nan

Thus, I think the code need to change as follows:

if torch.any(torch.isnan(per_class_accuracies[i])):

      per_class_accuracies[i] =  torch.where(torch.isnan(per_class_accuracies[i]),torch.full_like(per_class_accuracies[i],0),per_class_accuracies[i])

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions