Closed marios1861 closed 1 year ago
same here, scorecam returns NaNs for resnet and densenet
+1
Seems to be fixed for me. Must have been the pytorch 2.0 fallout.
Seems to be fixed for me. Must have been the pytorch 2.0 fallout.
@marios1861 What did you do to fix it?
I'm using torch1.12 but still getting the same issue
I am getting NaNs in masks when using ScoreCAM in resnet50. I have no idea on what could be wrong because the same exact code works fine for vgg16 and vit_b_16. I added a warning on the output of the ScoreCAM method
get_cam_weights
if the weights variable contains NaNs. I then traced back the error to line 40 of score_cam.py, specifically in some cases $maxs = mins$. After further inspection, it looks like the upsampled activations (and probably the original activations) happen to have totally deactivated channels (all elements are zero in the spatial dimensions). I don't know how to proceed from here. I am using the resnet50 weights from torchvision, as in the example, and my data is from the imagenet evaluation dataset. Also, everything works fine for gradcam and gradcam++