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

Bug in ClassLayer? #3

Closed
fjean opened this issue Sep 9, 2021 · 1 comment
Closed

Bug in ClassLayer? #3

fjean opened this issue Sep 9, 2021 · 1 comment

Comments

@fjean
Copy link

fjean commented Sep 9, 2021

In the forward method of class ClassLayer in lib/models.deeplab.py:

def forward(self, x):
        x = self.layer(x)
        x = self.classification(x)
        pred = x.view(x.shape[0], -1)
        pred = torch.sigmoid(self.fc(pred))
        return x, pred

the returned x does not represent feature maps anymore because self.classification is an AdaptiveAvgPooling2D with output_size=1, and thus returns a tensor with shape BxCx1x1. Then this is resized to the size of the image later, which doesn't seem to make sense.

Shouldn't it be like this?

def forward(self, x):
        x = self.layer(x)
        pred = self.classification(x)
        pred = pred.view(pred.shape[0], -1)
        pred = torch.sigmoid(self.fc(pred))
        return x, pred
@dongzhang89
Copy link
Owner

@fjean Thank you for your reminding. This bug has been fixed.

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