igul222 / improved_wgan_training

Code for reproducing experiments in "Improved Training of Wasserstein GANs"
MIT License
2.35k stars 670 forks source link

"python gan_64x64.py" met errors #28

Closed simonxue closed 7 years ago

simonxue commented 7 years ago

I've downloaded ImageNet small dataset (train_64x64.tar and valid_64x64.tar) and modified DATA_DIR in gan_64x64.py. I've also fixed a potential bug at line 116 (lib.concat -> tf.concat). But I still got the following error:

Traceback (most recent call last):
  File "gan_64x64.py", line 477, in <module>
    fake_data = Generator(BATCH_SIZE/len(DEVICES))
  File "gan_64x64.py", line 210, in GoodGenerator
    output = ResidualBlock('Generator.Res3', 2*dim, 2*dim, 3, output, resample='up')
  File "gan_64x64.py", line 186, in ResidualBlock
    he_init=False, biases=True, inputs=inputs)
  File "gan_64x64.py", line 120, in UpsampleConv
    output = lib.ops.conv2d.Conv2D(name, input_dim, output_dim, filter_size, output, he_init=he_init, biases=biases)
  File "/data1/home/weixue/cv/gan/improved_wgan_training/tflib/ops/conv2d.py", line 111, in Conv2D
    data_format='NCHW'
  File "/usr/lib/python2.7/site-packages/tensorflow/python/ops/gen_nn_ops.py", line 396, in conv2d
    data_format=data_format, name=name)
  File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/op_def_library.py", line 763, in apply_op
    op_def=op_def)
  File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 2329, in create_op
    set_shapes_for_outputs(ret)
  File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1717, in set_shapes_for_outputs
    shapes = shape_func(op)
  File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/ops.py", line 1667, in call_with_requiring
    return call_cpp_shape_fn(op, require_shape_fn=True)
  File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 610, in call_cpp_shape_fn
    debug_python_shape_fn, require_shape_fn)
  File "/usr/lib/python2.7/site-packages/tensorflow/python/framework/common_shapes.py", line 675, in _call_cpp_shape_fn_impl
    raise ValueError(err.message)
ValueError: Dimensions must be equal, but are 256 and 128 for 'Generator.Res3.Shortcut/Conv2D' (op: 'Conv2D') with input shapes: [64,256,32,32], [1,1,128,128].

It seems that the source code is still envolving. Is git "master" in a runnable state?

simonxue commented 7 years ago

line 210 in gan_64x64.py:

change

output = ResidualBlock('Generator.Res3', 2*dim, 2*dim, 3, output, resample='up')

to

output = ResidualBlock('Generator.Res3', 4*dim, 2*dim, 3, output, resample='up')
simonxue commented 7 years ago

line 358-361 in gan_64x64.py:

change ResidualBlock to BottleneckResidualBlock.

simonxue commented 7 years ago

It's runnable now, but is not generating any meaningful pictures. :-(

parkerzf commented 7 years ago

Any update on this? Which tensorflow version do you have?

I use tensorflow-gpu (1.1.0rc2), it has many incompatabilities:

Traceback (most recent call last): File "gan_64x64.py", line 485, in fake_data = Generator(BATCH_SIZE/len(DEVICES)) File "gan_64x64.py", line 216, in GoodGenerator output = Normalize('Generator.OutputN', output) TypeError: Normalize() takes exactly 3 arguments (2 given)

simonxue commented 7 years ago

I've moved to try gan_cifar.py, which could generate meaningful pics.

igul222 commented 7 years ago

Sorry for this! the bugs in gan_64x64.py should be fixed now.