In the GAN example of the documentation, did we update D several times before updating G?

조회 수: 3 (최근 30일)
SC
SC 2019년 11월 6일
댓글: SC 2020년 4월 11일
Hi,
In the following example of GAN for the deep learning toolbox ( https://www.mathworks.com/help/deeplearning/examples/train-generative-adversarial-network.html ), did we update Discriminator D several times before updating the generator G?
As per the GAN algorithm (say the original paper of Goodfellow 2014), we would update D k-times before updating G.
But I don't think the value of k is mentioned in the example. It looks like D and G are updated together in every loops.
The relevant codes:
% Update the discriminator network parameters.
[dlnetDiscriminator.Learnables,trailingAvgDiscriminator,trailingAvgSqDiscriminator] = ...
adamupdate(dlnetDiscriminator.Learnables, gradientsDiscriminator, ...
trailingAvgDiscriminator, trailingAvgSqDiscriminator, iteration, ...
learnRateDiscriminator, gradientDecayFactor, squaredGradientDecayFactor);
% Update the generator network parameters.
[dlnetGenerator.Learnables,trailingAvgGenerator,trailingAvgSqGenerator] = ...
adamupdate(dlnetGenerator.Learnables, gradientsGenerator, ...
trailingAvgGenerator, trailingAvgSqGenerator, iteration, ...
learnRateGenerator, gradientDecayFactor, squaredGradientDecayFactor);
Thanks!

답변 (1개)

Sourav Bairagya
Sourav Bairagya 2020년 1월 10일
GANs can be trained in many fashions. Here, discriminator, D is updated once before updating generator, G. Hence, first, discriminator, D is updated and then the generator, G is updated in every iteration.
  댓글 수: 1
SC
SC 2020년 4월 11일
So, to follow the original training fashion (i.e. update (D k-times and G 1-time) n times), we need to add one more inner loop to achieve that?

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Image Data Workflows에 대해 자세히 알아보기

제품


릴리스

R2019b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by