Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data to update G and D net is of the same batch? #30

Closed
lhao0301 opened this issue Jul 13, 2017 · 4 comments
Closed

Data to update G and D net is of the same batch? #30

lhao0301 opened this issue Jul 13, 2017 · 4 comments

Comments

@lhao0301
Copy link

lhao0301 commented Jul 13, 2017

As is known, data to update G and D net is of two different batches respectively in the classic gan (here I just consider one of these two gan nets). It's my first time to try TFRecord and so I have one question about it. Is the data of same batch here. If not, I guess data is updated once whether optimization of G or optimization of D is happened?

@vanhuyz
Copy link
Owner

vanhuyz commented Jul 13, 2017

Data is updated once after both optimization of G and optimization of D are finished here. But note that inputs of G and D are different. Data for G is a image obtained from TFRecord, but fake data for D is obtained from history of generated images.

@lhao0301
Copy link
Author

lhao0301 commented Jul 13, 2017

Sorry, my question may be ambiguous. In one iteration, assume that the input data for G is Z_0 and the corresponding input data for D is X_fake (X_fake is generated from Z_0) and X_real, then we input X_fake and X_real to D for updating D. To update G, we still input X_fake generated from Z_0 to D and calculate the loss. The same Z_0 is used during the update of D and G net. In other word, we use one same batch of Z for the update of both G and D in one iteration. However, in classic gan, two different batch of Z are used to update D and G. Sample one batch Z (called Z_0 to distinguish ) used to generate fake data for updating D and then sample one other batch Z (called Z_1) for updating G in one iteration.

@vanhuyz
Copy link
Owner

vanhuyz commented Jul 13, 2017

I understand your point. Maybe for that reason, instead of using the same Z_0 every time, CycleGAN randomly uses a image Z_1 from history of generated images to update D in order to make the training process stabler.

@lhao0301
Copy link
Author

Oh, it's right. According to the image pool, the input Z used to update D and G respectively is distinguished. It's same with classic gan (vanilla gan). Thank you very much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants