def discriminator_model(model_name="discriminator"):
disc_input = Input(shape=(400, 1), name="discriminator_input")
aux_input = Input(shape=(47,), name="auxilary_input")
# Conv Layer 1
x = Conv1D(filters=100, kernel_size=13, padding='same')(disc_input)
x = LeakyReLU(0.2)(x) # output shape is 100 x 400
x = AveragePooling1D(pool_size=20)(x) # ouput shape is 100 x 20
# Conv Layer 2
x = Conv1D(filters=250, kernel_size=13, padding='same')(x)
x = LeakyReLU(0.2)(x) # output shape is 250 x 20
x = AveragePooling1D(pool_size=5)(x) # output shape is 250 x 4
# Conv Layer 3
x = Conv1D(filters=300, kernel_size=13, padding='same')(x)
x = LeakyReLU(0.2)(x) # output shape is 300 x 4
x = Flatten()(x) # output shape is 1200
x = concatenate([x, aux_input], axis=-1) # shape is 1247
# Dense Layer 1
x = Dense(200)(x)
x = LeakyReLU(0.2)(x) # output shape is 200
# Dense Layer 2
x = Dense(1)(x)
x = Activation('sigmoid')(x)
discriminator_model = Model(
outputs=[x], inputs=[disc_input, aux_input], name=model_name)
return discriminator_model
评论列表
文章目录