Пример #1
0
    def __init__(self, channels):
        super(EncodeNet, self).__init__()

        self.conv_channels_up = nn.Conv2d(1, channels, 1)
        convList = []
        for i in range(4):
            convList.append(pixelShuffleFunction.PixelUnshuffle(2))
            if(i>=2):
                convList.append(nn.Conv2d(channels * 4, channels, 1))
            elif(i==0):
                convList.append(nn.Conv2d(channels * 4, channels, 5, padding=2))
            elif(i==1):
                convList.append(nn.Conv2d(channels * 4, channels, 3, padding=1))
            '''
            i kernel padding
            0 5      2
            1 3      1
            2 1      0
            3 1      0  
            '''
            convList.append(nn.LeakyReLU(inplace=True))
            convList.append(nn.BatchNorm2d(channels))
            convList.append(baseNet.ResNet(transpose=False, channels=channels, kernel_size=3, padding=1))

        convList.append(nn.Conv2d(channels, 16, 1))
        convList.append(nn.LeakyReLU(inplace=True))

        self.convList = nn.Sequential(*convList)
Пример #2
0
    def __init__(self, channels):
        super(EncodeNet, self).__init__()

        self.conv_channels_up = nn.Conv2d(1, channels, 1)
        convList = []
        for i in range(4):
            convList.append(pixelShuffleFunction.PixelUnshuffle(2))
            convList.append(nn.Conv2d(channels*4, channels, 1))
            convList.append(nn.LeakyReLU())

        convList.append(nn.Conv2d(channels, 16, 1))
        convList.append(nn.LeakyReLU())

        self.convList = nn.Sequential(*convList)
Пример #3
0
    def __init__(self, channels, downSample=True):
        super(SampleResNet, self).__init__()
        self.downSample = downSample
        convList = []
        if(self.downSample==True):
            convList.append(pixelShuffleFunction.PixelUnshuffle(2))
            convList.append(nn.Conv2d(channels * 4, channels, 1))
            convList.append(nn.LeakyReLU())
        else:
            convList.append(nn.Conv2d(channels, channels * 4, 1))
            convList.append(nn.LeakyReLU())
            convList.append(nn.PixelShuffle(2))

        self.convList = nn.Sequential(*convList)
Пример #4
0
    def __init__(self, channels):
        super(EncodeNet, self).__init__()

        self.conv_channels_up = nn.Conv2d(1, channels, 1)
        convList = []
        for i in range(4):
            convList.append(pixelShuffleFunction.PixelUnshuffle(2))
            if(i<=1):
                convList.append(nn.Conv2d(channels*4, channels, 3, padding=1))
            else:
                convList.append(nn.Conv2d(channels * 4, channels, 1))
            convList.append(nn.LeakyReLU(inplace=True))
            convList.append(nn.BatchNorm2d(channels))

        convList.append(nn.Conv2d(channels, 16, 1))
        convList.append(nn.LeakyReLU(inplace=True))

        self.convList = nn.Sequential(*convList)
Пример #5
0
    def __init__(self, channels):
        super(EncodeNet, self).__init__()

        self.conv_channels_up = nn.Conv2d(1, channels, 1)
        convList = []
        for i in range(4):
            convList.append(pixelShuffleFunction.PixelUnshuffle(2))
            convList.append(nn.Conv2d(channels * 4, channels, 1))
            convList.append(nn.LeakyReLU())
            convList.append(
                baseNet.ResNet(transpose=False,
                               channels=channels,
                               kernel_size=3,
                               padding=1))

        convList.append(nn.Conv2d(channels, 16, 1))
        convList.append(nn.LeakyReLU())

        self.convList = nn.Sequential(*convList)