DCGAN
DCGAN copied to clipboard
Generator compile
@rajathkmp Could you please tell why did you compiled Generator model in line 85
generator.compile(loss='binary_crossentropy', optimizer=adam, metrics=['accuracy'])
As while training we require and train only discriminator and dcgan as per line 132 and 135
discriminatorLoss = discriminator.train_on_batch(trainBatch, trainLabels)
dcganLoss = dcgan.train_on_batch(noisePredictBatch, dcganLabels)
@amitmanchanda1995 I was predicting the output after each epoch, so I had compiled it, it is not necessary if you are not interested in seeing the generator output after each iter
But .predict
works without compiling the model.
You only need forward propagation and no backward propagation so why do you need to compile with a specified loss function?
@amitmanchanda1995 Ahh, I remember now, check line 151. I could have simply reduced the lr of dcgan, but I have done it separately, to call the optimiser function I needed to compile it. You could also change line 150 and 151 with just dcgan.optimizer.lr, the output will be the same.