-
I have a model for binary classification that I trained on my own images. The model has a resnet18 backbone with some more dense layers after that and finally ends in a sigmoid function. As a result, the output of my model
I get an error My question is: what should I assign the My model definition is given below:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi, So you can now just use BinaryClassifierOutputTarget. |
Beta Was this translation helpful? Give feedback.
Hi,
The issue is that we need a target that supports the binary output case.
When we have a binary output, it's already the score of category 1.
So we can create a custom target that multiplies by 1 if we want the second category, and by -1 if we want to first category.
I added a custom target here:
https://github.com/jacobgil/pytorch-grad-cam/blob/master/pytorch_grad_cam/utils/model_targets.py#L21
So you can now just use BinaryClassifierOutputTarget.