2

I have a short dataset for recognizing Bengali alphabets (9600 data for training and 3000 for testing). The total number of classes: 50.

This seems to be a short number of data. So I was trying to augment the data set by ImageDataGenerator from keras.preprocessing.image. It was working well.

Now I'm trying to augment data by GAN network to generate a larger dataset.

I've read some basics and followed some tutorials. Like this one from deeplearning4j.org and followed this code from Github.

But I am at a loss how to generate the augmented data.

Maybe, I am missing some strategies. Can someone please tell me the strategies for generating data with GAN?

My Strategy was:

  1. Preparing training and test dataset.
  2. Training the Generator and discriminator.
  3. Generating new image by Generator
  4. Trying to discriminate between the real and fake image

After 100 epochs I got: enter image description here

Maxim
  • 52,561
  • 27
  • 155
  • 209
Sudarshan
  • 938
  • 14
  • 27
  • So where exactly are you getting stuck? Your approach to GANs seems reasonable, and should work for you. I want to point out that the number of pictures might be a little low for training a GAN, but should generally still work. – dennlinger Jun 28 '18 at 05:33
  • First of all to generate new data with gan. I tried with the code (linked in the question) with my dataset. and can generate only some noise only. – Sudarshan Jun 28 '18 at 05:36
  • Can you edit your post to contain maybe a sample image of your generated output, how many epochs you left the training running, whether you see constant improvement, etc.? Also, the code you linked is seemingly a stack of "regular" hidden layers (i.e. fully connected layers), from what I know about Keras. For the case of images you can get much better results by using a [DCGAN](https://github.com/jacobgil/keras-dcgan) (Deep Convolutional GAN), which simply replaces the architectures with regular convolutions/deconvolutions. That should also improve your results significantly. – dennlinger Jun 28 '18 at 05:40
  • Also the loss function defined in the code example you gave does not make any sense. Generally, to get a decent training curve, you have to flip the loss when it comes to training the generator (which is more what you want anyways). The theory behind that is explained well [here](https://wiseodd.github.io/techblog/2016/09/17/gan-tensorflow/). – dennlinger Jun 28 '18 at 05:45
  • Ok, I am posting my full code. And maybe I should give a try with you DCGAN code. – Sudarshan Jun 28 '18 at 05:45
  • Can I use [this Keras Implementation code](https://github.com/keras-team/keras/blob/master/examples/mnist_acgan.py) by changing the data set? – Sudarshan Jun 28 '18 at 05:51

0 Answers0