GAN/Architectures/models/infogan.py
def build_discriminator(self):
        """Override building of the discriminator. 
        
        We add an auxilaty model q for predicting the value of the categorical variable. This isn't
        compiled as it is never used in a standalone manner, only as part of the final gan."""
        # weight initialization
        init = RandomNormal(stddev=0.02)
        # image input
        in_image = Input(shape=self.in_shape)
        # downsample to 14x14
        d = Conv2D(64, (4,4), strides=(2,2), padding='same', kernel_initializer=init)(in_image)
        d = LeakyReLU(alpha=0.1)(d)
        # downsample to 7x7
        d = Conv2D(128, (4,4), strides=(2,2), padding='same', kernel_initializer=init)(d)
        d = LeakyReLU(alpha=0.1)(d)
        d = BatchNormalization()(d)
        # normal
        d = Conv2D(256, (4,4), padding='same', kernel_initializer=init)(d)
        d = LeakyReLU(alpha=0.1)(d)
        d = BatchNormalization()(d)
        # flatten feature maps
        d = Flatten()(d)
        # real/fake output
        out_classifier = Dense(1, activation='sigmoid')(d)
        # define d model
        self.d_model = Model(in_image, out_classifier)
        # compile d model
        self.d_model.compile(loss='binary_crossentropy', optimizer=Adam(lr=0.0002, beta_1=0.5), metrics=['accuracy'])

        # create q model layers
        q = Dense(128)(d)
        q = BatchNormalization()(q)
        q = LeakyReLU(alpha=0.1)(q)
        # q model output
        out_codes = Dense(self.n_cat, activation='softmax')(q)
        # define q model
        self.q_model = Model(in_image, out_codes)
Override building of the discriminator. 
        
        We add an auxilaty model q for predicting the value of the categorical variable. This isn't
        compiled as it is never used in a standalone manner, only as part of the final gan.
Override building of the discriminator.
We add an auxilaty model q for predicting the value of the categorical variable. This isn't
compiled as it is never used in a standalone manner, only as part of the final gan.
Override building of the discriminator . We add an auxilaty model q for predicting the value of the categorical variable . This isn ' t compiled as it is never used in a standalone manner only as part of the final gan .
def build_discriminator(self):
        init = RandomNormal(stddev=0.02)
        in_image = Input(shape=self.in_shape)
        d = Conv2D(64, (4,4), strides=(2,2), padding='same', kernel_initializer=init)(in_image)
        d = LeakyReLU(alpha=0.1)(d)
        d = Conv2D(128, (4,4), strides=(2,2), padding='same', kernel_initializer=init)(d)
        d = LeakyReLU(alpha=0.1)(d)
        d = BatchNormalization()(d)
        d = Conv2D(256, (4,4), padding='same', kernel_initializer=init)(d)
        d = LeakyReLU(alpha=0.1)(d)
        d = BatchNormalization()(d)
        d = Flatten()(d)
        out_classifier = Dense(1, activation='sigmoid')(d)
        self.d_model = Model(in_image, out_classifier)
        self.d_model.compile(loss='binary_crossentropy', optimizer=Adam(lr=0.0002, beta_1=0.5), metrics=['accuracy'])
        q = Dense(128)(d)
        q = BatchNormalization()(q)
        q = LeakyReLU(alpha=0.1)(q)
        out_codes = Dense(self.n_cat, activation='softmax')(q)
        self.q_model = Model(in_image, out_codes)
def build_discriminator ( self ) : init = RandomNormal ( stddev = 0.02 ) in_image = Input ( shape = self . in_shape ) d = Conv2D ( 64 , ( 4 , 4 ) , strides = ( 2 , 2 ) , padding = 'same' , kernel_initializer = init ) ( in_image ) d = LeakyReLU ( alpha = 0.1 ) ( d ) d = Conv2D ( 128 , ( 4 , 4 ) , strides = ( 2 , 2 ) , padding = 'same' , kernel_initializer = init ) ( d ) d = LeakyReLU ( alpha = 0.1 ) ( d ) d = BatchNormalization ( ) ( d ) d = Conv2D ( 256 , ( 4 , 4 ) , padding = 'same' , kernel_initializer = init ) ( d ) d = LeakyReLU ( alpha = 0.1 ) ( d ) d = BatchNormalization ( ) ( d ) d = Flatten ( ) ( d ) out_classifier = Dense ( 1 , activation = 'sigmoid' ) ( d ) self . d_model = Model ( in_image , out_classifier ) self . d_model . compile ( loss = 'binary_crossentropy' , optimizer = Adam ( lr = 0.0002 , beta_1 = 0.5 ) , metrics = [ 'accuracy' ] ) q = Dense ( 128 ) ( d ) q = BatchNormalization ( ) ( q ) q = LeakyReLU ( alpha = 0.1 ) ( q ) out_codes = Dense ( self . n_cat , activation = 'softmax' ) ( q ) self . q_model = Model ( in_image , out_codes )
Override building of the discriminator.
Override building of the discriminator .
"""Override building of the discriminator. 
        
        We add an auxilaty model q for predicting the value of the categorical variable. This isn't
        compiled as it is never used in a standalone manner, only as part of the final gan.""" # weight initialization # image input # downsample to 14x14 # downsample to 7x7 # normal # flatten feature maps # real/fake output # define d model # compile d model # create q model layers # q model output # define q model
self