haofanwang / Score-CAM

Official implementation of Score-CAM in PyTorch
MIT License
399 stars 66 forks source link

Softmax of scores across channels / Baseline image #6

Closed SirRob1997 closed 3 years ago

SirRob1997 commented 3 years ago

I have two questions and I couldn't find lines implementing the following functionality in scorecam.py:

Am I missing something?

haofanwang commented 3 years ago

Hi, @SirRob1997

Thanks for interests in our work.

  1. We use a black image as baseline, so we don't include it in code.
  2. The score is obtained after Softmax function, so it is a value within 0 to 1. We don't directly use the logit.
SirRob1997 commented 3 years ago

For 1: Even for a black image, the score of a class will not be zero, due to the learned biases. Given that it is a constant though, it doesn't matter too much, you're right.

For 2: The softmax is applied to the output of the model hence we softmax across the classes, obviously getting values [0,1]. However, this does not ensure that the scores across channels add up to 1 as you wrote in Algorithm 1.

haofanwang commented 3 years ago

Hi, @SirRob1997 , sorry for my late reply (I have been working on my CVPR submission).

You are right, this should be a typo and I think it does not matter. We just want to limit that every weight is within the same range.