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 = Convolution1D(nb_filter=100,
filter_length=13,
border_mode='same',
subsample_length=1)(disc_input)
x = LeakyReLU(0.2)(x) # output shape is 100 x 400
x = AveragePooling1D(pool_length=20)(x) # ouput shape is 100 x 20
# Conv Layer 2
x = Convolution1D(nb_filter=250,
filter_length=13,
border_mode='same',
subsample_length=1)(x)
x = LeakyReLU(0.2)(x) # output shape is 250 x 20
x = AveragePooling1D(pool_length=5)(x) # output shape is 250 x 4
# Conv Layer 3
x = Convolution1D(nb_filter=300,
filter_length=13,
border_mode='same',
subsample_length=1)(x)
x = LeakyReLU(0.2)(x) # output shape is 300 x 4
x = Flatten()(x) # output shape is 1200
x = merge([x, aux_input], mode="concat", concat_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)
x = Activation('linear')(x) # output shape is 1
discriminator_model = Model(
input=[disc_input, aux_input], output=[x], name=model_name)
return discriminator_model
评论列表
文章目录