ScoreCAM, SSCAM,ISCAM failed when feeding this image
ChordXy opened this issue ยท 2 comments
ChordXy commented
Bug description
When trying the example with torchcam v0.3.2dev0, the command is
python scripts/cam_example.py --arch resnet18 --class-idx 386 --img ./elephant.jpg --method ScoreCAM
The ScoreCAM seems to crash with no outputs.
By the way, when trying this command, it shows "WARNING:root:no value was provided for 'target_layer', thus set to 'layer4'"
Code snippet to reproduce the bug
python scripts/cam_example.py --arch resnet18 --class-idx 386 --img ./elephant.jpg --method ScoreCAM
Error traceback
Environment
torchcam v0.3.2dev0
frgfm commented
Hi @ChordXy ๐
Thanks for reporting this! Two thoughts / questions:
- if you got the visualisation, I doubt it has crashed. But it's possible that for this class index, the activation is almost uniform (and very very low). This could be possible if you passed a wrong class index
- you closed the issue so I assume you found the source of the problem. would you mind sharing it here as well please? ๐ always better to document a bit your findings ๐
Cheers โ๏ธ
ChordXy commented
I just test this and I find that the problem is caused by the version of PyTorch!
I have 2 devices. The code runs perfectly on my PC with torch==1.9.1 while it fails on my server with torch==1.10.2So I guess maybe the upgrade of torch version modifies some realization of functions leading to this consequence