Ejemplo n.º 1
0
    def Decoder(self):
        input_ = self.keras.layers.Input(shape=(4, 4, 1024))
        x = input_
        x = upscale(self.keras, x, 512)
        x = res(self.keras, x, 512)
        x = upscale(self.keras, x, 256)
        x = res(self.keras, x, 256)
        x = upscale(self.keras, x, 128)
        x = res(self.keras, x, 128)
        x = upscale(self.keras, x, 64)
        x = res(self.keras, x, 64)
        x = upscale(self.keras, x, 32)
        x = res(self.keras, x, 32)
        x = self.keras.layers.convolutional.Conv2D(3,
                                                   kernel_size=5,
                                                   padding='same',
                                                   activation='sigmoid')(x)

        y = input_  #mask decoder
        y = upscale(self.keras, y, 512)
        y = upscale(self.keras, y, 256)
        y = upscale(self.keras, y, 128)
        y = upscale(self.keras, y, 64)
        y = upscale(self.keras, y, 32)
        y = self.keras.layers.convolutional.Conv2D(1,
                                                   kernel_size=5,
                                                   padding='same',
                                                   activation='sigmoid')(y)

        return self.keras.models.Model(input_, [x, y])
Ejemplo n.º 2
0
    def Decoder(self, created_vram_gb):
        if created_vram_gb >= 4:
            input_ = self.keras.layers.Input(shape=(8, 8, 512))
            x = input_
            x = upscale(self.keras, x, 512)
            x = res(self.keras, x, 512)
            x = upscale(self.keras, x, 256)
            x = res(self.keras, x, 256)
            x = upscale(self.keras, x, 128)
            x = res(self.keras, x, 128)
            x = upscale(self.keras, x, 64)
            x = res(self.keras, x, 64)
        else:
            input_ = self.keras.layers.Input(shape=(8, 8, 256))
            x = input_
            x = upscale(self.keras, x, 256)
            x = res(self.keras, x, 256)
            x = upscale(self.keras, x, 128)
            x = res(self.keras, x, 128)
            x = upscale(self.keras, x, 64)
            x = res(self.keras, x, 64)
            x = upscale(self.keras, x, 32)
            x = res(self.keras, x, 32)

        x = self.keras.layers.convolutional.Conv2D(4,
                                                   kernel_size=5,
                                                   padding='same',
                                                   activation='sigmoid')(x)
        return self.keras.models.Model(input_, x)
Ejemplo n.º 3
0
 def DecoderCommon(self): 
     input_ = self.keras.layers.Input(shape=(4, 4, 1024))
     x = input_
     x = upscale(self.keras, x, 512)
     x = res(self.keras, x, 512)
     x = upscale(self.keras, x, 256)
     x = res(self.keras, x, 256)
     x = upscale(self.keras, x, 128)
     x = res(self.keras, x, 128)
     x = upscale(self.keras, x, 64)
     x = res(self.keras, x, 64)
     x = upscale(self.keras, x, 32)
     x = res(self.keras, x, 32)  
     
     y = input_
     y = upscale(self.keras, y, 256)
     y = upscale(self.keras, y, 128)
     y = upscale(self.keras, y, 64)
     y = upscale(self.keras, y, 32)
     y = upscale(self.keras, y, 16)
     
     return self.keras.models.Model(input_, [x,y])
Ejemplo n.º 4
0
    def Decoder(self, created_vram_gb):
        if created_vram_gb >= 4:
            input_ = self.keras.layers.Input(shape=(8, 8, 512))
            x = input_
            x = upscale(self.keras, x, 512)
            x = res(self.keras, x, 512)
            x = upscale(self.keras, x, 256)
            x = res(self.keras, x, 256)
            x = upscale(self.keras, x, 128)
            x = res(self.keras, x, 128)
            x = upscale(self.keras, x, 64)
            x = res(self.keras, x, 64)

            y = input_  #mask decoder
            y = upscale(self.keras, y, 512)
            y = upscale(self.keras, y, 256)
            y = upscale(self.keras, y, 128)
            y = upscale(self.keras, y, 64)
        else:
            input_ = self.keras.layers.Input(shape=(8, 8, 256))
            x = input_
            x = upscale(self.keras, x, 256)
            x = res(self.keras, x, 256)
            x = upscale(self.keras, x, 128)
            x = res(self.keras, x, 128)
            x = upscale(self.keras, x, 64)
            x = res(self.keras, x, 64)
            x = upscale(self.keras, x, 32)
            x = res(self.keras, x, 32)

            y = input_  #mask decoder
            y = self.upscale(256)(y)
            y = self.upscale(128)(y)
            y = self.upscale(64)(y)
            y = self.upscale(32)(y)

        x = self.keras.layers.convolutional.Conv2D(3,
                                                   kernel_size=5,
                                                   padding='same',
                                                   activation='sigmoid')(x)
        y = self.keras.layers.convolutional.Conv2D(1,
                                                   kernel_size=5,
                                                   padding='same',
                                                   activation='sigmoid')(y)

        return self.keras.models.Model(input_, [x, y])