Unable to add noise to DCGAN

Hi! I’m really new to GAN’s and was trying DCGAN for generating samples of COVID-19 Chest-Xrays. I was exploring the possibility of using GAN’s to increase the dataset and to see if it helps improve a classifier. I was trying to add white noise to the Discriminator and I am unable to figure out how to do so. Can someone help? I understand that I need to add the noise to the input but I am unable to do so.

You could define the mean and std and add the noise directly to your input image:

mean = 0.
std = 10.
noise = (torch.randn(1, 3, 224, 224) + mean) * std
input = input + noise

Let me know, if that would work for you.

@ptrblck This seems to be working! However after reading up, I did find that it is a good practice to decay/ reduce the noise for every iteration. Any inputs as to how that can be incorporated?

Good to hear it’s working!
You could divide the standard deviation of the noise with the current epoch or use any other decaying function.

@ptrblck Thanks a lot for your inputs! If there’s any other suggestions you might have for training GANs, I’d be grateful! Anyways thanks for the help!

My best suggestion is a lot of patience. :wink:

That’s the best advice! Thanks! :grin: