Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scorecam seems to be weighting all feature maps equally #103

Open
amirro1 opened this issue Feb 5, 2024 · 0 comments
Open

scorecam seems to be weighting all feature maps equally #103

amirro1 opened this issue Feb 5, 2024 · 0 comments

Comments

@amirro1
Copy link

amirro1 commented Feb 5, 2024

Hi,

Thanks so much for this awesome repo.

I have been using the gradCAM and gradCAM++ functionality, and it has been working great. However, when I try to use the scorecam functionality, I am seeing some odd behavior. Specifically, the output appears to be an equal weighting of all of my activation maps from the last convolutional layer (rather than a weighting based on the score of the perturbed input images)

Because it seemed as though all of weights were equal, I dug into the source code where the weights were computed (inside the call method of scorecam.py). Here, I noticed that even though the scores of my perturbed images varied, the following line seemed to push every weight to 1:

weights = ([score(K.softmax(tf.constant(p))) for p in prediction]
                  for score, prediction in zip(scores, preds))

Could this be an issue with my score function ( I included the score function below)? Is there a way to formulate my model and input such that this line will not push every weight to 1?

Thanks,
Amy

Simple score function:

def score_function_pos(output):
    score =output[:, 0]
    return score
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant