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

Regarding the code #5

Closed
laukun opened this issue Oct 11, 2018 · 1 comment
Closed

Regarding the code #5

laukun opened this issue Oct 11, 2018 · 1 comment

Comments

@laukun
Copy link

laukun commented Oct 11, 2018

Thank author for the code. I have two small questions:

  1. regarding this small block of code below to obtain cam:
    def forward_cam(self, x):
    x = super().forward(x)
    x = self.fc8(x)
    x = F.relu(x)
    x = torch.sqrt(x)
    return x
    what's x=torch.sqrt(x) for?
  2. regarding the pretrained caffe weghts, i.e. vgg16_20M.prototxt, on what dataset was it trained on? were you meant to use the deeplab_LargeFOV model of vgg16 version as the network to compute CAM, but why setting fc6_dilation=1 not 12 as in deeplab v1 paper?
@jiwoon-ahn
Copy link
Owner

jiwoon-ahn commented Oct 11, 2018

  • VGG16_20M model was trained on ImageNet as deeplab v1 paper says.
  • I just wanted to adopt DeepLab in CAM and AffinityNet because it will be used for semantic segmentation anyway.
  • I think other questions are highly related to the above. To convert DeepLab as a CAM network, I followed https://arxiv.org/pdf/1701.08261.pdf. (which includes removing last max polling layer, adjusting dilation rate, etc.)
  • Then, I found that as the last maxpooling layer was removed, the varaince of the activation map has become different which can be simply compensated by x = torch.sqrt(x). (This is not neccessary when tyring with other backbone networks such as VGG-GAP https://github.com/metalbubble/CAM)

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

2 participants