Hi everyone, I have an issue with getting the right indices for predicted classes of the probabilities returned by topk function of pytorch.
My output classes are just 2 (cancerous and noncancerous) and the directories are labeled as (0 for cancerous and 1 for noncancerous).
Unfortunately, after getting my output from model.forward(), applying the softmax function and applying the topk function, I get reasonable probalities but the indices tend to be [436, 600] (out of range) instead of [0,1] which represents my class directories.
I have tried a number way to detect the source of these large index values, but couldn’t have an answer. Help on this would be appreciated.
The screenshop below is a typical example of what I am talking about, just that mine is only 2 classes.

image.png852×725 57.4 KB