def make_dcgan_generator(Xk_g, n_lat, n_chan=1):
n_g_hid1 = 1024 # size of hidden layer in generator layer 1
n_g_hid2 = 128 # size of hidden layer in generator layer 2
x = Dense(n_g_hid1)(Xk_g)
x = BatchNormalization(mode=2)(x)
x = Activation('relu')(x)
x = Dense(n_g_hid2*7*7)(x)
x = BatchNormalization(mode=2)(x)
x = Activation('relu')(x)
x = Reshape((n_g_hid2, 7, 7))(x)
x = Deconvolution2D(64, 5, 5, output_shape=(128, 64, 14, 14),
border_mode='same', activation=None, subsample=(2,2),
init='orthogonal', dim_ordering='th')(x)
x = BatchNormalization(mode=2, axis=1)(x)
x = Activation('relu')(x)
g = Deconvolution2D(n_chan, 5, 5, output_shape=(128, n_chan, 28, 28),
border_mode='same', activation='sigmoid', subsample=(2,2),
init='orthogonal', dim_ordering='th')(x)
return g
评论列表
文章目录