Пример #1
0
    def __init__(self, in_channels, out_channels, lightweight):
        super(DecoderBlock, self).__init__()

        self.conv1 = nn.Sequential(
            conv3x3(in_channels, out_channels, lightweight),
            nn.BatchNorm2d(out_channels), nn.ReLU(True))
        self.conv2 = nn.Sequential(
            conv3x3(out_channels, out_channels, lightweight),
            nn.BatchNorm2d(out_channels), nn.ReLU(True))

        self.attention1 = SCSEModule(in_channels)
        self.attention2 = SCSEModule(out_channels)
    def __init__(self, in_channels, out_channels, lightweight):
        super(FCNHead, self).__init__()
        inter_channels = in_channels // 4

        self.head = nn.Sequential(
            conv3x3(in_channels, inter_channels, lightweight),
            nn.BatchNorm2d(inter_channels), nn.ReLU(True),
            nn.Dropout(0.1, False),
            nn.Conv2d(inter_channels, out_channels, 1, bias=True))
    def __init__(self, in_channels, out_channels, lightweight):
        super(PSPHead, self).__init__()
        inter_channels = in_channels // 4

        self.conv5 = nn.Sequential(
            PyramidPooling(in_channels),
            conv3x3(in_channels + 4 * int(in_channels / 4), inter_channels,
                    lightweight), nn.BatchNorm2d(inter_channels),
            nn.ReLU(True), nn.Dropout(0.1, False),
            nn.Conv2d(inter_channels, out_channels, 1))
Пример #4
0
    def __init__(self, backbone, pretrained, nclass, lightweight):
        super(DeepLabV3Plus, self).__init__(backbone, pretrained)

        low_level_channels = self.backbone.channels[1]
        high_level_channels = self.backbone.channels[-1]

        self.head = FCNHead(high_level_channels, nclass, lightweight)

        self.reduce_bin = nn.Sequential(
            nn.Conv2d(low_level_channels, 48, 1, bias=False),
            nn.BatchNorm2d(48), nn.ReLU(True))

        self.fuse_bin = nn.Sequential(
            conv3x3(high_level_channels // 8 + 48, 256, lightweight),
            nn.BatchNorm2d(256), nn.ReLU(True), conv3x3(256, 256, lightweight),
            nn.BatchNorm2d(256), nn.ReLU(True), nn.Dropout(0.1, False))

        self.head_bin = ASPPModule(high_level_channels, [12, 24, 36],
                                   lightweight)

        self.classifier_bin = nn.Conv2d(256, 1, 1, bias=True)
Пример #5
0
def ASPPConv(in_channels, out_channels, atrous_rate, lightweight):
    block = nn.Sequential(
        conv3x3(in_channels, out_channels, lightweight, atrous_rate),
        nn.BatchNorm2d(out_channels), nn.ReLU(True))
    return block