zhoubolei / CAM

Class Activation Mapping
http://cnnlocalization.csail.mit.edu/
MIT License
1.84k stars 466 forks source link

1. Dimension of weight_softmax[idx] and features channel 2. Upsampling (directly resize)? #48

Open qsunyuan opened 2 years ago

qsunyuan commented 2 years ago

Meet this interesting work so late.

Here is my little doubt.

https://github.com/zhoubolei/CAM/blob/c63f2850a7a3dadc21fa1b021875e2d4d053ece5/pytorch_CAM.py#L48

  1. The dimension of weight_softmax[idx] should be 512. However, for layer4's nc, it should be 256. Is there a mistake here? In other words, I suspect that CAM can only be used for the last layer, so as to match the dimension of 512.
  2. Is there a better process for upsampling the final class activation map? I feel the resize is a bit rough.
qsunyuan commented 2 years ago

The resize code link:

https://github.com/zhoubolei/CAM/blob/c63f2850a7a3dadc21fa1b021875e2d4d053ece5/pytorch_CAM.py#L94