Skip to content

scorecam seems to be weighting all feature maps equally #103

Description

@amirro1

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions