I want to do a binary classification and I used the DenseNet from Pytorch.
Here is my predict code:
densenet = torch.load(model_path)
densenet.eval()
output = densenet(input)
print(output)
And here is the output:
Variable containing:
54.4869 -54.3721
[torch.cuda.FloatTensor of size 1x2 (GPU 0)]
I want to get the probabilities of each class. What should I do?
I have noticed that torch.nn.Softmax()
could be used when there are many categories, as discussed here.