Exemple #1
0
    def __init__(self):
        super(R3Net, self).__init__()
        res50 = ResNeXt101()
        self.layer0 = res50.layer0
        self.layer1 = res50.layer1
        self.layer2 = res50.layer2
        self.layer3 = res50.layer3
        self.layer4 = res50.layer4

        self.reduce_low = nn.Sequential(
            nn.Conv2d(64 + 256 + 512, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce_high = nn.Sequential(
            nn.Conv2d(1024 + 2048, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), _ASPP(256))

        self.predict0 = nn.Conv2d(256, 1, kernel_size=1)
        self.predict1 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict2 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict3 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict4 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict5 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict6 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        for m in self.modules():
            if isinstance(m, nn.ReLU) or isinstance(m, nn.Dropout):
                m.inplace = True
Exemple #2
0
    def __init__(self, num_features=128):
        super(J0, self).__init__()
        self.num_features = num_features

        resnext = ResNeXt101()
        self.layer0 = resnext.layer0
        self.layer1 = resnext.layer1
        self.layer2 = resnext.layer2
        self.layer3 = resnext.layer3
        self.layer4 = resnext.layer4

        self.down1 = nn.Sequential(nn.Conv2d(256, num_features, kernel_size=1),
                                   nn.SELU())
        self.down2 = nn.Sequential(nn.Conv2d(512, num_features, kernel_size=1),
                                   nn.SELU())
        self.down3 = nn.Sequential(
            nn.Conv2d(1024, num_features, kernel_size=1), nn.SELU())
        self.down4 = nn.Sequential(
            nn.Conv2d(2048, num_features, kernel_size=1), nn.SELU())

        self.t = nn.Sequential(
            nn.Conv2d(num_features,
                      num_features // 2,
                      kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features // 2, 1, kernel_size=1), nn.Sigmoid())
        self.a = nn.Sequential(
            nn.AdaptiveAvgPool2d(1),
            nn.Conv2d(num_features, num_features, kernel_size=1), nn.SELU(),
            nn.Conv2d(num_features, num_features, kernel_size=1), nn.SELU(),
            nn.Conv2d(num_features, 1, kernel_size=1), nn.Sigmoid())

        self.refine = nn.Sequential(
            nn.Conv2d(num_features, num_features, kernel_size=3, padding=1),
            nn.SELU(),
            nn.Conv2d(num_features, num_features, kernel_size=3, padding=1),
            nn.SELU(), nn.Conv2d(num_features, num_features, kernel_size=1))

        for m in self.modules():
            if isinstance(m, nn.SELU) or isinstance(m, nn.ReLU):
                m.inplace = True
Exemple #3
0
    def __init__(self, num_classes):
        super(SDCNet, self).__init__()
        res50 = ResNeXt101()
        self.layer0 = res50.layer0
        self.layer1 = res50.layer1
        self.layer2 = res50.layer2
        self.layer3 = res50.layer3
        self.layer4 = res50.layer4

        self.reducex = nn.Sequential(
            nn.Conv2d(2048, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), _ASPP(256))
        self.reduce5 = nn.Sequential(
            nn.Conv2d(64 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce6 = nn.Sequential(
            nn.Conv2d(512, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce7 = nn.Sequential(
            nn.Conv2d(512, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce8 = nn.Sequential(
            nn.Conv2d(512, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce9 = nn.Sequential(
            nn.Conv2d(512, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce10 = nn.Sequential(
            nn.Conv2d(512, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        # --------------extra module---------------
        self.reduce3_0 = nn.Sequential(
            nn.Conv2d(1024 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce3_1 = nn.Sequential(
            nn.Conv2d(1024 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce3_2 = nn.Sequential(
            nn.Conv2d(1024 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce3_3 = nn.Sequential(
            nn.Conv2d(1024 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce3_4 = nn.Sequential(
            nn.Conv2d(1024 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce2_0 = nn.Sequential(
            nn.Conv2d(512 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce2_1 = nn.Sequential(
            nn.Conv2d(512 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce2_2 = nn.Sequential(
            nn.Conv2d(512 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce2_3 = nn.Sequential(
            nn.Conv2d(512 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce2_4 = nn.Sequential(
            nn.Conv2d(512 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())

        self.reduce1_0 = nn.Sequential(
            nn.Conv2d(256 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce1_1 = nn.Sequential(
            nn.Conv2d(256 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce1_2 = nn.Sequential(
            nn.Conv2d(256 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce1_3 = nn.Sequential(
            nn.Conv2d(256 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce1_4 = nn.Sequential(
            nn.Conv2d(256 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())

        self.reduce0_0 = nn.Sequential(
            nn.Conv2d(64, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce0_1 = nn.Sequential(
            nn.Conv2d(64, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce0_2 = nn.Sequential(
            nn.Conv2d(64, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce0_3 = nn.Sequential(
            nn.Conv2d(64, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reduce0_4 = nn.Sequential(
            nn.Conv2d(64, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(), nn.Conv2d(256, 256,
                                                       kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        # self.predict0 = nn.Conv2d(256, 1, kernel_size=1)
        self.predict1 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict2 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict3 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict4 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict5 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict6 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict7 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict8 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict9 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        self.predict10 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))

        self.pre4 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 2, kernel_size=1))
        self.pre3 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 2, kernel_size=1))
        self.pre2 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 2, kernel_size=1))
        self.pre1 = nn.Sequential(
            nn.Conv2d(256, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 2, kernel_size=1))
        self.reducex_1 = nn.Sequential(
            nn.Conv2d(256 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reducex_2 = nn.Sequential(
            nn.Conv2d(512 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())
        self.reducex_3 = nn.Sequential(
            nn.Conv2d(1024 + 256, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())

        for m in self.modules():
            if isinstance(m, nn.ReLU) or isinstance(m, nn.Dropout):
                m.inplace = True

        self.avg_pool = nn.AdaptiveAvgPool2d(1)
        self.fc0 = nn.Sequential(
            nn.BatchNorm1d(256),
            nn.Dropout(0.5),
            nn.Linear(256, num_classes),
        )
Exemple #4
0
    def __init__(self):
        super(BDRAR, self).__init__()
        resnext = ResNeXt101()
        self.layer0 = resnext.layer0
        self.layer1 = resnext.layer1
        self.layer2 = resnext.layer2
        self.layer3 = resnext.layer3
        self.layer4 = resnext.layer4

        self.down4 = nn.Sequential(
            nn.Conv2d(2048, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU()
        )
        self.down3 = nn.Sequential(
            nn.Conv2d(1024, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU()
        )
        self.down2 = nn.Sequential(
            nn.Conv2d(512, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU()
        )
        self.down1 = nn.Sequential(
            nn.Conv2d(256, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU()
        )

        self.refine3_hl = nn.Sequential(
            nn.Conv2d(64, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 3, padding=1, groups=32, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 1, bias=False), nn.BatchNorm2d(32)
        )
        self.refine2_hl = nn.Sequential(
            nn.Conv2d(64, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 3, padding=1, groups=32, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 1, bias=False), nn.BatchNorm2d(32)
        )
        self.refine1_hl = nn.Sequential(
            nn.Conv2d(64, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 3, padding=1, groups=32, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 1, bias=False), nn.BatchNorm2d(32)
        )
        self.attention3_hl = _AttentionModule()
        self.attention2_hl = _AttentionModule()
        self.attention1_hl = _AttentionModule()

        self.refine2_lh = nn.Sequential(
            nn.Conv2d(64, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 3, padding=1, groups=32, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 1, bias=False), nn.BatchNorm2d(32)
        )
        self.refine4_lh = nn.Sequential(
            nn.Conv2d(64, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 3, padding=1, groups=32, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 1, bias=False), nn.BatchNorm2d(32)
        )
        self.refine3_lh = nn.Sequential(
            nn.Conv2d(64, 32, 1, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 3, padding=1, groups=32, bias=False), nn.BatchNorm2d(32), nn.ReLU(),
            nn.Conv2d(32, 32, 1, bias=False), nn.BatchNorm2d(32)
        )
        self.attention2_lh = _AttentionModule()
        self.attention3_lh = _AttentionModule()
        self.attention4_lh = _AttentionModule()

        self.fuse_attention = nn.Sequential(
            nn.Conv2d(64, 16, 3, padding=1, bias=False), nn.BatchNorm2d(16), nn.ReLU(),
            nn.Conv2d(16, 2, 1)
        )

        self.predict = nn.Sequential(
            nn.Conv2d(32, 8, 3, padding=1, bias=False), nn.BatchNorm2d(8), nn.ReLU(),
            nn.Dropout(0.1), nn.Conv2d(8, 1, 1)
        )

        for m in self.modules():
            if isinstance(m, nn.ReLU) or isinstance(m, nn.Dropout):
                m.inplace = True
Exemple #5
0
    def __init__(self):
        super(R3Net, self).__init__()

        resnext = ResNeXt101()
        # 对应的五个阶段
        self.layer0 = resnext.layer0
        self.layer1 = resnext.layer1
        self.layer2 = resnext.layer2
        self.layer3 = resnext.layer3
        self.layer4 = resnext.layer4

        # F1, F2, F3
        self.reduce_low = nn.Sequential(
            nn.Conv2d(64 + 256 + 512, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), nn.Conv2d(256, 256, kernel_size=1),
            nn.BatchNorm2d(256), nn.PReLU())

        # F4, F5
        self.reduce_high = nn.Sequential(
            nn.Conv2d(1024 + 2048, 256, kernel_size=3, padding=1),
            nn.BatchNorm2d(256), nn.PReLU(),
            nn.Conv2d(256, 256, kernel_size=3, padding=1), nn.BatchNorm2d(256),
            nn.PReLU(), _ASPP(256))

        # 使用高层次特征预测S0
        self.predict0 = nn.Conv2d(256, 1, kernel_size=1)

        # Residual1
        self.predict1 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        # Residual2
        self.predict2 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        # Residual3
        self.predict3 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        # Residual4
        self.predict4 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        # Residual5
        self.predict5 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))
        # Residual6
        self.predict6 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128),
            nn.PReLU(), nn.Conv2d(128, 128, kernel_size=3, padding=1),
            nn.BatchNorm2d(128), nn.PReLU(), nn.Conv2d(128, 1, kernel_size=1))

        # self.rnn_0 = RNN(1, 3, 1)
        # self.rnn_1 = RNN(1, 3, 1)
        # self.rnn_2 = RNN(1, 3, 1)
        # self.rnn_3 = RNN(1, 3, 1)
        # self.rnn_4 = RNN(1, 3, 1)
        # self.rnn_5 = RNN(1, 3, 1)
        # self.rnn_6 = RNN(1, 3, 1)

        for m in self.modules():
            if isinstance(m, nn.ReLU) or isinstance(m, nn.Dropout):
                m.inplace = True
Exemple #6
0
 def __init__(self):
     super(STFM, self).__init__()
     resnext = ResNeXt101()
     self.layer0 = resnext.layer0
     self.layer1 = resnext.layer1
     self.layer2 = resnext.layer2
     self.layer3 = resnext.layer3
     self.layer4 = resnext.layer4
     # --------------------------------------------------------------------------------
     self.ASPP = _ASPP()
     self.down4 = nn.Sequential(
         nn.Conv2d(2048, 64, 1, bias=False), nn.BatchNorm2d(64), nn.PReLU()
     )
     self.down3 = nn.Sequential(
         nn.Conv2d(1024, 64, 1, bias=False), nn.BatchNorm2d(64), nn.PReLU()
     )
     self.down2 = nn.Sequential(
         nn.Conv2d(512, 64, 1, bias=False), nn.BatchNorm2d(64), nn.PReLU()
     )
     self.down1 = nn.Sequential(
         nn.Conv2d(256, 64, 1, bias=False), nn.BatchNorm2d(64), nn.PReLU()
     )
     self.down0 = nn.Sequential(
         nn.Conv2d(64, 64, 1, bias=False), nn.BatchNorm2d(64), nn.PReLU()
     )
     # --------------------------------------------------------------------------------
     self.refine4 = nn.Sequential(
         nn.Conv2d(192, 128, 3, padding=1, bias=False), nn.BatchNorm2d(128), nn.PReLU(),
         nn.Conv2d(128, 64, 3, padding=1, bias=False), nn.BatchNorm2d(64), nn.PReLU(),
         nn.Conv2d(64, 64, 1, bias=False), nn.BatchNorm2d(64)
     )   
     self.refine3 = nn.Sequential(
         nn.Conv2d(192, 128, 3, padding=1, bias=False), nn.BatchNorm2d(128), nn.PReLU(),
         nn.Conv2d(128, 64, 3, padding=1, bias=False), nn.BatchNorm2d(64), nn.PReLU(),
         nn.Conv2d(64, 64, 1, bias=False), nn.BatchNorm2d(64)
     )
     self.refine2 = nn.Sequential(
         nn.Conv2d(192, 128, 3, padding=1, bias=False), nn.BatchNorm2d(128), nn.PReLU(),
         nn.Conv2d(128, 64, 3, padding=1, bias=False), nn.BatchNorm2d(64), nn.PReLU(),
         nn.Conv2d(64, 64, 1, bias=False), nn.BatchNorm2d(64)
     )
     self.refine1 = nn.Sequential(
         nn.Conv2d(192, 128, 3, padding=1, bias=False), nn.BatchNorm2d(128), nn.PReLU(),
         nn.Conv2d(128, 64, 3, padding=1, bias=False), nn.BatchNorm2d(64), nn.PReLU(),
         nn.Conv2d(64, 64, 1, bias=False), nn.BatchNorm2d(64)
     )
     self.refine0 = nn.Sequential(
         nn.Conv2d(192, 128, 3, padding=1, bias=False), nn.BatchNorm2d(128), nn.PReLU(),
         nn.Conv2d(128, 64, 3, padding=1, bias=False), nn.BatchNorm2d(64), nn.PReLU(),
         nn.Conv2d(64, 64, 1, bias=False), nn.BatchNorm2d(64)
     )
     self.predict0 = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predict1 = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predict2 = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predict3 = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predict4 = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predictA = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     # -------------------------------------------------------------------------------- 
     self.strm0 = STRM()  
     self.strm1 = STRM()
     self.strm2 = STRM()
     self.strm3 = STRM()
     self.strm4 = STRM()
     self.strm4A = STRM()
     # --------------------------------------------------------------------------------
     self.predict0_a = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predict1_a = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predict2_a = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predict3_a = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
     self.predict4_a = nn.Sequential(
         nn.Conv2d(64, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 32, 3, padding=1, bias=False), nn.BatchNorm2d(32), nn.PReLU(),
         nn.Conv2d(32, 1, 1)
     )
Exemple #7
0
    def __init__(self, num_features=128):
        super(ours_wo_J0, self).__init__()
        self.num_features = num_features

        resnext = ResNeXt101()
        self.layer0 = resnext.layer0
        self.layer1 = resnext.layer1
        self.layer2 = resnext.layer2
        self.layer3 = resnext.layer3
        self.layer4 = resnext.layer4

        self.down1 = nn.Sequential(nn.Conv2d(256, num_features, kernel_size=1),
                                   nn.SELU())
        self.down2 = nn.Sequential(nn.Conv2d(512, num_features, kernel_size=1),
                                   nn.SELU())
        self.down3 = nn.Sequential(
            nn.Conv2d(1024, num_features, kernel_size=1), nn.SELU())
        self.down4 = nn.Sequential(
            nn.Conv2d(2048, num_features, kernel_size=1), nn.SELU())

        self.attention0 = nn.Sequential(
            nn.Conv2d(num_features * 4, num_features, kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features, num_features, kernel_size=3, padding=1),
            nn.SELU(), nn.Conv2d(num_features, num_features * 4,
                                 kernel_size=1))
        self.attention1 = nn.Sequential(
            nn.Conv2d(num_features * 4, num_features, kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features, num_features, kernel_size=3, padding=1),
            nn.SELU(), nn.Conv2d(num_features, num_features * 4,
                                 kernel_size=1))
        self.attention2 = nn.Sequential(
            nn.Conv2d(num_features * 4, num_features, kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features, num_features, kernel_size=3, padding=1),
            nn.SELU(), nn.Conv2d(num_features, num_features * 4,
                                 kernel_size=1))
        self.attention3 = nn.Sequential(
            nn.Conv2d(num_features * 4, num_features, kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features, num_features, kernel_size=3, padding=1),
            nn.SELU(), nn.Conv2d(num_features, num_features * 4,
                                 kernel_size=1))

        self.refine = nn.Sequential(
            nn.Conv2d(num_features, num_features, kernel_size=3, padding=1),
            nn.SELU(),
            nn.Conv2d(num_features, num_features, kernel_size=3, padding=1),
            nn.SELU(), nn.Conv2d(num_features, num_features, kernel_size=1))

        self.p0 = nn.Sequential(
            nn.Conv2d(num_features,
                      num_features // 2,
                      kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features // 2, 3, kernel_size=1))
        self.p1 = nn.Sequential(
            nn.Conv2d(num_features,
                      num_features // 2,
                      kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features // 2, 3, kernel_size=1))
        self.p2 = nn.Sequential(
            nn.Conv2d(num_features,
                      num_features // 2,
                      kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features // 2, 3, kernel_size=1))
        self.p3 = nn.Sequential(
            nn.Conv2d(num_features,
                      num_features // 2,
                      kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features // 2, 3, kernel_size=1))

        self.attentional_fusion = nn.Sequential(
            nn.Conv2d(num_features * 4, num_features, kernel_size=1),
            nn.SELU(),
            nn.Conv2d(num_features,
                      num_features // 2,
                      kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features // 2,
                      num_features // 2,
                      kernel_size=3,
                      padding=1), nn.SELU(),
            nn.Conv2d(num_features // 2, 12, kernel_size=1))

        for m in self.modules():
            if isinstance(m, nn.SELU) or isinstance(m, nn.ReLU):
                m.inplace = True
Exemple #8
0
    def __init__(self):
        super(BR2Net, self).__init__()
        resnext = ResNeXt101()
        self.layer0 = resnext.layer0
        self.layer1 = resnext.layer1
        self.layer2 = resnext.layer2
        self.layer3 = resnext.layer3
        self.layer4 = resnext.layer4

        ## channel weighted feature maps
        self.CAlayer0 = nn.Sequential(CALayer(64,16))
        self.CAlayer1 = nn.Sequential(CALayer(256,16))
        self.CAlayer2 = nn.Sequential(CALayer(512,16))
        self.CAlayer3 = nn.Sequential(CALayer(1024,16))
        self.CAlayer4 = nn.Sequential(CALayer(2048,16))

        ## Low to High
        self.predictL2H0 = nn.Conv2d(64, 1, kernel_size=1)
        self.predictL2H1 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 1, kernel_size=1)
        )
        self.predictL2H2 = nn.Sequential(
            nn.Conv2d(513, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 1, kernel_size=1)
        )
        self.predictL2H3 = nn.Sequential(
            nn.Conv2d(1025, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 1, kernel_size=1)
        )
        self.predictL2H4 = nn.Sequential(
            nn.Conv2d(2049, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 1, kernel_size=1)
        )

		## High to Low 
        self.predictH2L0 = nn.Conv2d(2048, 1, kernel_size=1)
        self.predictH2L1 = nn.Sequential(
            nn.Conv2d(1025, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 1, kernel_size=1)
        )
        self.predictH2L2 = nn.Sequential(
            nn.Conv2d(513, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 1, kernel_size=1)
        )
        self.predictH2L3 = nn.Sequential(
            nn.Conv2d(257, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 1, kernel_size=1)
        )
        self.predictH2L4 = nn.Sequential(
            nn.Conv2d(65, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 128, kernel_size=3, padding=1), nn.BatchNorm2d(128), nn.PReLU(),
            nn.Conv2d(128, 1, kernel_size=1)
        )

		###
        for m in self.modules():
            if isinstance(m, nn.ReLU) or isinstance(m, nn.Dropout):
                m.inplace = True
Exemple #9
0
    def __init__(self):
        super(DAF, self).__init__()
        self.resnext = ResNeXt101(32)

        self.down4 = nn.Sequential(
            nn.Conv2d(2048, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )
        self.down3 = nn.Sequential(
            nn.Conv2d(1024, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )
        self.down2 = nn.Sequential(
            nn.Conv2d(512, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )
        self.down1 = nn.Sequential(
            nn.Conv2d(256, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )

        self.fuse1 = nn.Sequential(
            nn.Conv2d(256, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )

        self.attention4 = nn.Sequential(
            nn.Conv2d(128, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.Softmax2d()
        )
        self.attention3 = nn.Sequential(
            nn.Conv2d(128, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.Softmax2d()
        )
        self.attention2 = nn.Sequential(
            nn.Conv2d(128, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.Softmax2d()
        )
        self.attention1 = nn.Sequential(
            nn.Conv2d(128, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.Softmax2d()
        )

        self.refine4 = nn.Sequential(
            nn.Conv2d(128, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )
        self.refine3 = nn.Sequential(
            nn.Conv2d(128, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )
        self.refine2 = nn.Sequential(
            nn.Conv2d(128, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )
        self.refine1 = nn.Sequential(
            nn.Conv2d(128, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=3, padding=1), nn.BatchNorm2d(64), nn.PReLU(),
            nn.Conv2d(64, 64, kernel_size=1), nn.BatchNorm2d(64), nn.PReLU()
        )

        self.predict4 = nn.Conv2d(64, 1, kernel_size=1)
        self.predict3 = nn.Conv2d(64, 1, kernel_size=1)
        self.predict2 = nn.Conv2d(64, 1, kernel_size=1)
        self.predict1 = nn.Conv2d(64, 1, kernel_size=1)

        self.predict4_2 = nn.Conv2d(64, 1, kernel_size=1)
        self.predict3_2 = nn.Conv2d(64, 1, kernel_size=1)
        self.predict2_2 = nn.Conv2d(64, 1, kernel_size=1)
        self.predict1_2 = nn.Conv2d(64, 1, kernel_size=1)