我正在研究条件GAN,我的生成器和鉴别器都有两个输入,并使用如下所示的合并模型:-
z = Input(shape=(100,))
temp = Input(shape=(384,))
generator=Generator()
img = generator([z,temp])
valid = discriminator([img,temp])
combined = Model([z,temp], valid)
combined.compile(loss='binary_crossentropy', optimizer=optimizer)
DCGAN被用于分类和生成以“ temp”嵌入为条件的图像,并且我对两个模型都使用Adam“ optimizer = Adam(0.0001,0.5)”。
GEN就像输入噪声“ z”一样,“ temp”将它们合并并生成128x128x3图像。光盘拍摄图像并对其执行conv2d,然后将“ temp”整形为1,128,3,合并两者,然后进一步应用conv2d,并输出一个S型单元。我的问题是,在反向传播期间,合并模型的权重如何更新,让我们在这里说说Disc:-
inp1 = Input(shape=(128,128,3),name='inp1')
inp2 = Input(shape=(384,),name='inp2')
d2=Reshape(target_shape=(1,128,3))(inp2)
d1 = Conv2D(16, kernel_size=5, strides=2, padding="same")(inp1)
d1=LeakyReLU(alpha=0.2)(d1)
d1=Dropout(0.25)(d1)
d1 = Conv2D(32, kernel_size=5, strides=2, padding="same")(inp1)
d1=BatchNormalization(momentum=0.8)(d1)
d1=LeakyReLU(alpha=0.2)(d1)
d1=Dropout(0.25)(d1)
d1 = Conv2D(64, kernel_size=5, strides=2, padding="same")(inp1)
d1=BatchNormalization(momentum=0.8)(d1)
d1=LeakyReLU(alpha=0.2)(d1)
d1=Dropout(0.25)(d1)
d1 = Conv2D(128, kernel_size=5, strides=2, padding="same")(inp1)
d1=BatchNormalization(momentum=0.8)(d1)
d1=LeakyReLU(alpha=0.2)(d1)
d1=Dropout(0.25)(d1)
d1 = Conv2D(256, kernel_size=5, strides=2, padding="same")(inp1)
d1=BatchNormalization(momentum=0.8)(d1)
d1=LeakyReLU(alpha=0.2)(d1)
d1=Dropout(0.25)(d1)
d1=Flatten()(d1)
d1=Dense(768, activation="relu")(d1)
d1=Reshape(target_shape=(2,128,3))(d1)
output=concatenate(
[
d1,
d2,
]
,axis=1
)
d1 = Conv2D(64, kernel_size=5, strides=2, padding="same")(output)
d1=BatchNormalization(momentum=0.8)(d1)
d1=LeakyReLU(alpha=0.2)(d1)
d1=Dropout(0.25)(d1)
d1 = Conv2D(128, kernel_size=5, strides=2, padding="same")(inp1)
d1=BatchNormalization(momentum=0.8)(d1)
d1=LeakyReLU(alpha=0.2)(d1)
d1=Dropout(0.25)(d1)
d1 = Conv2D(256, kernel_size=5, strides=2, padding="same")(inp1)
d1=BatchNormalization(momentum=0.8)(d1)
d1=LeakyReLU(alpha=0.2)(d1)
d1=Dropout(0.25)(d1)
d1=Flatten()(d1)
output=Dense(1,activation='sigmoid')(d1)
model=Model(
inputs=[
inp1,
inp2
],
outputs=[
output
]
)
model.summary()
img = Input(shape=(128,128,3))
text=Input(shape=(384,))
validity = model([img,text])
return Model([img,text], validity)
我的光盘丢失从2.02开始,在150个周期内达到约6.7,Gen的丢失在150个周期内从0.80降至0.00024,并且我越来越垃圾,如何改善体系结构?而且我想知道也许backprop在合并模型中不能很好地工作,因为它变得非常复杂。 我正在使用batchnorm,泄漏的relu,conv2d + stride,但是没有池化层和标签平滑处理。