cbam_cnn_architectures_image_classification icon indicating copy to clipboard operation
cbam_cnn_architectures_image_classification copied to clipboard

Question regarding channel attention module.

Open seanko29 opened this issue 2 years ago • 0 comments

Hello there!

I was looking at VGG16 with CBAM.

From the forward function, I see the following lines of codes

def forward(self,x):
    x = self.features_1(x)
    scale = torch.nn.functional.sigmoid(self.max_pool_1(x) + self.avg_pool_1(x)).expand_as(x)
    x = x * scale
    scale = torch.cat((torch.max(x, 1)[0].unsqueeze(1), torch.mean(x, 1).unsqueeze(1)), dim=1)
    scale = self.spatial_attention(scale)
    x = x * scale

image

I do not see shared MLP part of the code. I see that you get the maxpool and average pool of the input feature but you added sigmoid right away on top of shared MLP.

Can you explain where the shared MLP part is in the lines of codes of the forward function?

Thank you in advanced :).

seanko29 avatar Mar 01 '23 08:03 seanko29