carpedm20 / DCGAN-tensorflow

A tensorflow implementation of "Deep Convolutional Generative Adversarial Networks"
http://carpedm20.github.io/faces/
MIT License
7.15k stars 2.63k forks source link

Question: why it generates 100 times the same image (under samples/test_arange_n.png)? #204

Open gcardozo123 opened 7 years ago

gcardozo123 commented 7 years ago

Hi, I'm using my own dataset with only 9 images, with this configuration:

flags.DEFINE_integer("epoch", 40, "Epoch to train [40]")
flags.DEFINE_float("learning_rate", 0.0002, "Learning rate of for adam [0.0002]")
flags.DEFINE_float("beta1", 0.5, "Momentum term of adam [0.5]")
flags.DEFINE_integer("train_size", np.inf, "The size of train images [np.inf]")
flags.DEFINE_integer("batch_size", 1, "The size of batch images [1]")
flags.DEFINE_integer("input_height", 224, "The size of image to use (will be center cropped). [108]")
flags.DEFINE_integer("input_width", 256, "The size of image to use (will be center cropped). If None, same value as input_height [None]")
flags.DEFINE_integer("output_height", 224, "The size of the output images to produce [64]")
flags.DEFINE_integer("output_width", 256, "The size of the output images to produce. If None, same value as output_height [None]")
flags.DEFINE_string("dataset", "TEST_SET", "The name of dataset [TEST_SET]")
flags.DEFINE_string("input_fname_pattern", "*.jpg", "Glob pattern of filename of input images [*]")
flags.DEFINE_string("checkpoint_dir", "checkpoint", "Directory name to save the checkpoints [checkpoint]")
flags.DEFINE_string("sample_dir", "samples", "Directory name to save the image samples [samples]")
flags.DEFINE_boolean("train", True, "True for training, False for testing [False]")
flags.DEFINE_boolean("crop", False, "True for training, False for testing [False]")
flags.DEFINE_boolean("visualize", False, "True for visualizing, False for nothing [False]")

But this is generating 100 times the same image: samples/test_arange_0.png, samples/test_arange_1.png, ..., samples/test_arange_99.png. Also, my g_loss is always zero.

Can someone explain why it happens?

Thank you for your time!

mmbrian commented 7 years ago

Same here. I've used the default parameters to train on celebA but on test time it always generates a single face. for me different test_arange_X.png images have slightly different illumination or minor changes around the borders but the face stays the same (as if the model is over-fitting).

mmbrian commented 7 years ago

Actually, I figured out my problem was that I was using option 1 when running visualize which only samples with zeros. switching to option 0 fixed the problem. now samples are generated uniformly between -0.5 and 0.5.

machinecode1234 commented 7 years ago

@mmbrian Hey, I have the same problem. How did you solved the problem. I didn't get.

mmbrian commented 7 years ago

@machinecode1234 in line 93 in main.py, change OPTION to 0. check out visualize method to see what happens with different options.