DCGAN icon indicating copy to clipboard operation
DCGAN copied to clipboard

Generator compile

Open a2tm7a opened this issue 7 years ago • 3 comments

@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)

a2tm7a avatar Nov 12 '17 11:11 a2tm7a

@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

rajathkmp avatar Nov 12 '17 17:11 rajathkmp

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?

a2tm7a avatar Nov 12 '17 17:11 a2tm7a

@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.

rajathkmp avatar Nov 12 '17 21:11 rajathkmp