Closed mhashas closed 2 years ago
Yes, I find the same problem too. I modified the code from Grad-CAM++ to adapt 1D ECG signal. I use the output of Grad-CAM to visualize my ECG data.
My model is 1D-ResNet34 with CBAM module and target_layers is model.layer4[-1]. It's similar to the original ResNet34 model. And my task is a multi-label classification task.
There are results for two different target_categories. It's more than similar. I calculate the difference of all results of different target_categories, the max difference is like 1e-6.
I think we need to distinguish between two possibilities:
I think if we can try this, it will help debug:
Can you save the grayscale cam mask (in the range 0-1), multiply the image by it, so only the high scoring areas are kept, and then run the model on the new image? Are the scores of all the categories still high or are they low now?
Can you please try the other models, like ScoreCAM and AblationCAM, do they get similar results?
Yes, I find the same problem too. I modified the code from Grad-CAM++ to adapt 1D ECG signal. I use the output of Grad-CAM to visualize my ECG data.
My model is 1D-ResNet34 with CBAM module and target_layers is model.layer4[-1]. It's similar to the original ResNet34 model. And my task is a multi-label classification task.
There are results for two different target_categories. It's more than similar. I calculate the difference of all results of different target_categories, the max difference is like 1e-6.
I have solved this problem because I find that my modification for 1D data is wrong. After correcting mistakes, it works well. Here are the current results for two different target_categories. Hope @mhashas you can find some code bugs too.
Great. Closing for now, please re-open if still relevant.
@jacobgil
The problem for me was setting eigen_smooth to True. Setting it to False solves the issue
@mhashas It is the same for me. I also noted that the smoothed areas are not similar to the originally found areas as illustrated in the images.
eigen_smooth = True (First Image Class 1, Second Image Class 2):
eigen_smooth = False (First Image Class 1, Second Image Class 2):
I have used the trick that you mentioned of creating multiple SingleOutput models by returning x[task].
My network looks like this: Resnet18 -> tasks x linear layers
Do you have any advice on what I could try to do?