I'm now trying to implement GAN in keras. I want to use both the GAN loss and the generator loss at the same time when I train the network. Because I've found from some papers that this might contribute to some performance gain.
It is a little bit like the loss function in the paper 'Multi-Scale Video Frame-Synthesis Network with Transitive Consistency Loss': Loss function
The original code with the GAN loss alone is like the following:
self.generator = generator
self.discriminator = discriminator
self.gan = Sequential([generator, discriminator])
gen, dis, gendis = self.generator, self.discriminator, self.gan
gendis.compile(optimizer=opt, loss='binary_crossentropy')
I'd like to combine the generator loss together. Thus, I tried the following:
gendis.compile(optimizer=opt, loss={'generator_output': 'mse', 'model_2':'binary_crossentropy'}, loss_weights=[1., 0.2])
But it doesn't work and show the error message: ' ValueError: Unknown entry in loss dictionary: "generator_output". Only expected the following keys: ['model_2']'.
How can I add the generator loss into this training procedure?
Thanks a lot!