Captum: [Question] Upsample layer attribution to input size

Created on 20 Sep 2020  路  5Comments  路  Source: pytorch/captum

Hi,
I probably missed some details and a bit confused. I hope this is the right place to ask the following question.

Why does it make sense to upsample a layer attribution to input size to see where the model "looks"? For example, we know that the receptive field of a unit in the last convolutional layer of Alexnet almost covers the whole image (https://distill.pub/2019/computing-receptive-fields/). If we upsample a layer attribution map of the final convolutional layer, would we not assume that the model always focuses on the center of the receptive field? Such as what is done with LayerGradCam (https://captum.ai/api/layer.html#gradcam). I am aware that the original authors of GradCam use bilinear interpolation for upsampling, but I don't understand how it makes sense.

question

All 5 comments

Hi @yanbek

With a 224x224 input, the final layer in AlexNet produces a 13x13 feature maps. CAM-based approaches first compute which pixels in these maps are behind the CNN decision.
Imagine, they decide the most salient features are at a tiny 2x2 square in these maps located at 10th row (out of 13) and 10th column (out of 13). This roughly corresponds to a 35x35 patch in the input image located at (172, 172). Upsampling helps us locate this patch to visually understand what objects the CNN might be looking at. Gradient-based CAM helps in computing fine-grained attribution.

Hope this helps

Hi @bilalsal, thanks for the answer. I get what you are saying since 224 / 13 = 17.23. Hence, a 2x2 is 34x34 approximately in the input space.

However, the problem is, the receptive field of the last convolutional layer in Alexnet covers 163x163 (https://github.com/google-research/receptive_field/blob/master/receptive_field/RECEPTIVE_FIELD_TABLE.md) when mapped to input. Would we not assume that the network always focuses on the center of the receptive field if we do bilinear interpolation to upsample. Can't a unit focus somewhere else in the receptive field?

Hope this clarifies my question

Edit: I guess it makes a bit more sense because of this: "the distribution of impact within the receptive field is asymptotically Gaussian, and the effective receptive field only takes up a fraction of the full theoretical receptive field." (https://arxiv.org/pdf/1701.04128.pdf).

Yes exactly, the center of a RF for a pixel contributes exponentially more than the periphery.

Okay, so if we assume that the focus is always at the center of RF and that the effective RF follows a bivariate gaussian. Could it mean that a pixel in the middle of the 2x2 square (when mapped to the input) can have higher attribution than any of the 4 values in the 2x2 square (if their effective RF overlaps greatly)? So bilinear interpolation would just be approximately correct?

That sounds like a plausible factor, besides many factors that determine the attribution assigned to a pixel.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

eburling picture eburling  路  3Comments

hchong-ml picture hchong-ml  路  3Comments

elboyran picture elboyran  路  5Comments

zwacke picture zwacke  路  5Comments

gorogoroyasu picture gorogoroyasu  路  5Comments