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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Making ASPP-Layer in DeepLab more generic #2136

Closed
ArashJavan opened this issue Apr 23, 2020 · 3 comments
Closed

Making ASPP-Layer in DeepLab more generic #2136

ArashJavan opened this issue Apr 23, 2020 · 3 comments

Comments

@ArashJavan
Copy link
Contributor

ArashJavan commented Apr 23, 2020

馃殌 Feature

At the moment in the ASPP-Layer defined here the number of output channels is predefined as a constant, which is good for DeepLab but not if someone else - like me ;) , want to use it in another project, where another out-channel Nr. is required.

Also the number of "atrous rates" is fixed to three, which also could be sometime more or less dpeending on the notwork. Again these fixed values may make sense in DeepLab-Model but not necessarily in other type of model, which in my case is applied on Lidar data.

that means something like this would be at least IMO better:

class ASPP(nn.Module):
    def __init__(self, in_channels, atrous_rates, out_channel=256):
        super(ASPP, self).__init__()
        modules = []
        modules.append(nn.Sequential(
            nn.Conv2d(in_channels, out_channels, 1, bias=False),
            nn.BatchNorm2d(out_channels),
            nn.ReLU()))
        
        rates = tuple(atrous_rates)
        for rate in rates:
             modules.append(ASPPConv(in_channels, out_channels, rate))
      
        modules.append(ASPPPooling(in_channels, out_channels))
      
        self.convs = nn.ModuleList(modules)

        self.project = nn.Sequential(
            nn.Conv2d(5 * out_channels, out_channels, 1, bias=False),
            nn.BatchNorm2d(out_channels),
            nn.ReLU(),
            nn.Dropout(0.5))

@ArashJavan ArashJavan changed the title Making ASPP-Layer in DeepLab more user friendly Making ASPP-Layer in DeepLab more generic Apr 23, 2020
@vincentqb
Copy link
Contributor

This looks reasonable to me, and is backward compatible. Do you want to open a pull request for this?

@ArashJavan
Copy link
Contributor Author

ArashJavan commented Apr 25, 2020

@vincentqb Ok, thank, yes i will open a poll req.

@fmassa
Copy link
Member

fmassa commented May 4, 2020

Fixed via #2174

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants