frgfm/torch-cam

What is class_idx in __call__() ??

edwardcho opened this issue ยท 6 comments

Hello sir,
I want to display heat-map for my classification task.
So i found your library.
What is class_idx of call()??
(I think that it is class index of top-1)

And,
Using my datasets,
I met nan.
In compute_cam() of core.py
My result of torch.nansum has all < 0.
Then F.relu return all 0.
So, in normalization, it return nan.

Is this nornal??
If not, what should i change in my data??

Thanks.
Edward cho

frgfm commented

Hi there ๐Ÿ‘‹

a CAM is relative to the class output of the model, not necessarily the top 1. So this arg needs to be an integer in the range of (0, N - 1) where N is the number of output classes ;)

Regarding your error, I would need a minimal runnable snippet to reproduce as I'm not sure what you mean here :/ For issues, it's better to fill the bug report template next time please ๐Ÿ™

Cheers โœŒ๏ธ

Hi there ๐Ÿ‘‹

a CAM is relative to the class output of the model, not necessarily the top 1. So this arg needs to be an integer in the range of (0, N - 1) where N is the number of output classes ;)

Regarding your error, I would need a minimal runnable snippet to reproduce as I'm not sure what you mean here :/ For issues, it's better to fill the bug report template next time please ๐Ÿ™

Cheers โœŒ๏ธ

Hello sir.
As you know, the CAM is for checking of decision of deep learning tasks, i think.
So i want to use evidence of top-1 on classification task.
If so, class-idx should be class index of top-1. Right??

Thanks,
Edward cho

frgfm commented

If so, class-idx should be class index of top-1. Right??

As mentioned above, yes you can!

However regarding your error, I'll need a runnable snippet to reproduce this behaviour ๐Ÿ™

frgfm commented

Any update @edwardcho ? :)

frgfm commented

Hello @edwardcho ๐Ÿ‘‹

Mind providing a minimal script to reproduce the behavior you described? ๐Ÿ™
Otherwise I'll close the issue since I cannot do anything about this without more details ๐Ÿ˜…

frgfm commented

The NaN problem you mention is fixed by #185. For the rest, I have no way of reproducing it, so I'm closing the issue!
Feel free to reopen if you encounter some trouble :)