Closed AND2797 closed 4 years ago
If it is a misclassification and the true class is not provided, yeah.
So in this case would it be appropriate to raise an assertion error? For eg: I input class 5, but the model output indicates that the image is classified as class 4, which would be incorrect
If you enter a target class then target class would not be None.
No what I mean is this ->
target_class
= 5
, and image corresponding to target_class
= 5
.torch.argmax(model_output).item()
is not 5
, then in this case it means that the model has incorrectly classified the image, so will it not give incorrect results?If the user enters target_class
= 5
, then the target_class is not None and what is inside the if condition will not be executed.
I am a little confused, can you explain what happens if the true class is given and a mis-classification occurs?
Please read the code. If the target_class is not provided, it is taken from the prediction. When the target_class is provided, what comes out of the prediction is not used. So, there is no case when the user provides a class (e.g., 5) and the target_class magically changes to 44.
Thanks for the clarification.
There is a line in gradcam.py which says that if
target_class = None
then thetarget_class
takes the argmax of the ouptut. Is it possible that the actual class might be different from the expected class?