Comments (23)
@aosokin
The code for running the GAN is the first link and the models the second. Let me know if you have any questions or figure out your problem!
https://github.com/rafaelvalle/neural_network_control_improvisation/blob/master/wcgan_text.py
https://github.com/rafaelvalle/neural_network_control_improvisation/blob/master/models.py
from wassersteingan.
@appierys Hi, thanks for the notice. Could you share some code snippets on how you did this?
from wassersteingan.
I've successfully trained a conditional WGAN as well. But I am using WGAN-GP version. Maybe that's the difference?
BTW, I found that I need to keep training even after original WGAN loss is converged.
from wassersteingan.
Have you tried passing your noise through a dense layer and then concatenating its output with the labels.
from wassersteingan.
@rafaelvalle Yes, I've tried combining CGAN or ACGAN, but it never worked.
I always saw one of the two failure modes: Wassestein objective converges, but conditioning is just ignored; Wasserstein objective does not converge at all.
from wassersteingan.
@aosokin Did you try providing both the critic and generator with the condition?
There's some paper, I don't remember which, that suggests using conditioning whenever possible.
from wassersteingan.
@rafaelvalle there should be some theoretical reasoning behind this. I would assume that adding the conditioning vector once to the data should be sufficient. I believe that is the case for vanilla GANs.
from wassersteingan.
@rafaelvalle yes, I've tried several things like they go in the ACGAN paper, but never could make it work.
from wassersteingan.
@aosokin Did you try looking at the gradients close to your noise and condition vector?
Are the images normalized ?
How many classes do you have and what type of data?
from wassersteingan.
Did you try looking at the gradients close to your noise and condition vector?
Towards convergence most of the parameters are clipped, so the gradients all look outside.
Are the images normalized ?
yes, to [-1, 1]
How many classes do you have and what type of data?
I've tried 6 classes on some images. I should probably try it on a MNIST, but did not have time.
I'm curious if there is any success story on conditioning WGAN on anything.
from wassersteingan.
@aosokin I was successful conditioning WGAN on ~70 classes with chromatic images.
I've read that conditional image generation with GANs, not WGANs, benefit from L2 loss. Maybe there's an adaptation go WGAN?
https://arxiv.org/pdf/1611.07004v1.pdf
from wassersteingan.
I was successful conditioning WGAN on ~70 classes with chromatic images.
Could you share a code snippet on what worked?
Would be very helpful.
I've read that conditional image generation with GANs, not WGANs, benefit from L2 loss.
But that's image conditioned on image, which is even harder. For me, even conditioning on labels did not work. Maybe I just did something wrong.
from wassersteingan.
@rafaelvalle Great, thanks a lot! I'll try this version out
from wassersteingan.
@aosokin
Have you tried implementing things from zi2zi: Master Chinese Calligraphy with Conditional Adversarial Networks.
@martinarjovsky any suggestions on how to combine the WGAN loss with a classification loss, say categorical crossentropy?
from wassersteingan.
@rafaelvalle Hi, I've tried some things along the lines of your code, but it still does not work, but I still observe the same result: the conditioning is ignored in the end of the day.
The key difference to what I as doing before appeared in when to merge image and label signal in the critic: I was doing this early at the image level, you are merging it in later. I've tried both and see no difference.
zi2zi: Master Chinese Calligraphy with Conditional Adversarial Networks.
This seems to do a very different thing.
Have you tried passing your noise through a dense layer and then concatenating its output with the labels.
Yes, I've tried that, but it did not change the outcome at all.
from wassersteingan.
@aosokin Did you try conditioning à la wavenet, z = tanh(Wk * X + VkC), where * is convolution and W and V are the weights at layer K?
from wassersteingan.
@rafaelvalle Hi, trying to view your first link above but it doesn't seem to be working. Could you re-post?
from wassersteingan.
Hi @aosokin , I'm trying something similar with conditional WGAN and observed similar behaviour, either conditioning is completely ignored or the network doesn't converge.
I added a second loss to the generator as well (L2 loss) to 'guide' the results in the correct direction. This setup is pretty sensitive to lambda (the multiplier) for the GAN loss. The training now appears to be headed in the right direction but it is still early days yet.
from wassersteingan.
I've spent some time to implement WACGAN-GP for MNIST this morning. The results seem to be acceptable. The sample jupyter notebook is as follows: WACGAN-GP-MNIST
from wassersteingan.
@appierys Hi,Could you share some code to show how you do it
from wassersteingan.
@weihancug Hi, I think the notebook provided above already shows a working conditional WGAN ?
WAGCAN-GP-MNIST
from wassersteingan.
I've found other implementations of cWGAN:
Looks like WGAN is ok with conditional settings since many people could reproduce the results.
from wassersteingan.
Here's an implementation of conditional WGAN-GP. https://github.com/kongyanye/cwgan-gp
from wassersteingan.
Related Issues (20)
- After training the model, how to generate Test samples using the generator?
- Where can I find bibtex of Wasserstein GAN and related works? HOT 1
- Why have a tensor of 1 or -1 in loss.backward()? HOT 1
- Problems with the optimization of loss. HOT 4
- cifar10 result not good as expect ! HOT 7
- how to train a 256*128 image dataset and output 256*128 result? HOT 3
- Results on cifar10 very bad even if trained for over 1000 epochs HOT 1
- The parameter ‘db_path' of LSUN setting in 'main.py' should be changed to 'root'
- Results cannot be reproduced. HOT 2
- module name can\'t contain "." HOT 1
- Inconsistent loss function from the paper? HOT 8
- No convergence in onw dataset
- No sigmoid activation for G on MLP?
- should the gamma and beta on batchnormalization layer be clipped?
- some problem when running the WassersteinGAN HOT 1
- Interpreting Generator and Critic loss HOT 1
- How can I use a loss as the stopping criteria in Wasserstein GAN?
- Why did not tell the label to the discriminator
- Generator update HOT 1
- I cannot find the calculating or estimating of wasserstein distance! HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wassersteingan.