GAN/Architectures/models/infogan.py
def build_generator(self):
        """Override building the standalone generator model.
        
        This will take latent space like a conditional gan and the n_cat control variables."""
        gen_input_size = self.latent_dim + self.n_cat

        # weight initialization
        init = RandomNormal(stddev=0.02)
        # image generator input
        in_lat = Input(shape=(gen_input_size,))
        # foundation for 7x7 image
        n_nodes = 512 * 7 * 7
        gen = Dense(n_nodes, kernel_initializer=init)(in_lat)
        gen = Activation('relu')(gen)
        gen = BatchNormalization()(gen)
        gen = Reshape((7, 7, 512))(gen)
        # normal
        gen = Conv2D(128, (4,4), padding='same', kernel_initializer=init)(gen)
        gen = Activation('relu')(gen)
        gen = BatchNormalization()(gen)
        # upsample to 14x14
        gen = Conv2DTranspose(64, (4,4), strides=(2,2), padding='same', kernel_initializer=init)(gen)
        gen = Activation('relu')(gen)
        gen = BatchNormalization()(gen)
        # upsample to 28x28
        gen = Conv2DTranspose(1, (4,4), strides=(2,2), padding='same', kernel_initializer=init)(gen)
        # tanh output
        out_layer = Activation('tanh')(gen)
        # define model
        self.g_model = Model(in_lat, out_layer)
Override building the standalone generator model.
        
        This will take latent space like a conditional gan and the n_cat control variables.
Override building the standalone generator model.
This will take latent space like a conditional gan and the n_cat control variables.
Override building the standalone generator model . This will take latent space like a conditional gan and the n_cat control variables .
def build_generator(self):
        gen_input_size = self.latent_dim + self.n_cat
        init = RandomNormal(stddev=0.02)
        in_lat = Input(shape=(gen_input_size,))
        n_nodes = 512 * 7 * 7
        gen = Dense(n_nodes, kernel_initializer=init)(in_lat)
        gen = Activation('relu')(gen)
        gen = BatchNormalization()(gen)
        gen = Reshape((7, 7, 512))(gen)
        gen = Conv2D(128, (4,4), padding='same', kernel_initializer=init)(gen)
        gen = Activation('relu')(gen)
        gen = BatchNormalization()(gen)
        gen = Conv2DTranspose(64, (4,4), strides=(2,2), padding='same', kernel_initializer=init)(gen)
        gen = Activation('relu')(gen)
        gen = BatchNormalization()(gen)
        gen = Conv2DTranspose(1, (4,4), strides=(2,2), padding='same', kernel_initializer=init)(gen)
        out_layer = Activation('tanh')(gen)
        self.g_model = Model(in_lat, out_layer)
def build_generator ( self ) : gen_input_size = self . latent_dim + self . n_cat init = RandomNormal ( stddev = 0.02 ) in_lat = Input ( shape = ( gen_input_size , ) ) n_nodes = 512 * 7 * 7 gen = Dense ( n_nodes , kernel_initializer = init ) ( in_lat ) gen = Activation ( 'relu' ) ( gen ) gen = BatchNormalization ( ) ( gen ) gen = Reshape ( ( 7 , 7 , 512 ) ) ( gen ) gen = Conv2D ( 128 , ( 4 , 4 ) , padding = 'same' , kernel_initializer = init ) ( gen ) gen = Activation ( 'relu' ) ( gen ) gen = BatchNormalization ( ) ( gen ) gen = Conv2DTranspose ( 64 , ( 4 , 4 ) , strides = ( 2 , 2 ) , padding = 'same' , kernel_initializer = init ) ( gen ) gen = Activation ( 'relu' ) ( gen ) gen = BatchNormalization ( ) ( gen ) gen = Conv2DTranspose ( 1 , ( 4 , 4 ) , strides = ( 2 , 2 ) , padding = 'same' , kernel_initializer = init ) ( gen ) out_layer = Activation ( 'tanh' ) ( gen ) self . g_model = Model ( in_lat , out_layer )
Override building the standalone generator model.
Override building the standalone generator model .
"""Override building the standalone generator model.
        
        This will take latent space like a conditional gan and the n_cat control variables.""" # weight initialization # image generator input # foundation for 7x7 image # normal # upsample to 14x14 # upsample to 28x28 # tanh output # define model
self