bioinf-jku / TTUR

Two time-scale update rule for training GANs
Apache License 2.0
856 stars 173 forks source link

Error in computing fid during training. ValueError: Cannot iterate over a shape with unknown rank. #10

Open Ayesha-Rafiq opened 6 years ago

Ayesha-Rafiq commented 6 years ago

Epoch: [ 0] [ 0/ 305] time: 14.0901, d_loss: 1.75800323, g_loss: 0.26850128 [Sample] d_loss: 1.03988624, g_loss: 1.53502333 samples for incept 2/2 ok Traceback (most recent call last): File "main.py", line 161, in tf.app.run() File "C:\Users\Waqar\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\platform\app.py", line 48, in run _sys.exit(main(_sys.argv[:1] + flags_passthrough)) File "main.py", line 144, in main dcgan.train(FLAGS) File "D:\downloads\TTUR-master\TTUR-master\DCGAN_FID_batched\model.py", line 381, in train verbose=self.fid_verbose) File "D:\downloads\TTUR-master\TTUR-master\DCGAN_FID_batched\fid.py", line 175, in calculate_activation_statistics act = get_activations(images, sess, batch_size, verbose) File "D:\downloads\TTUR-master\TTUR-master\DCGAN_FID_batched\fid.py", line 82, in get_activations inception_layer = _get_inception_layer(sess) File "D:\downloads\TTUR-master\TTUR-master\DCGAN_FID_batched\fid.py", line 55, in _get_inception_layer shape = [s.value for s in shape] File "C:\Users\Waqar\AppData\Local\Programs\Python\Python35\lib\site-packages\tensorflow\python\framework\tensor_shape.py", line 497, in iter raise ValueError("Cannot iterate over a shape with unknown rank.") ValueError: Cannot iterate over a shape with unknown rank.

mhex commented 6 years ago

Hi, which Tensorflow version do you use?

Ayesha-Rafiq commented 6 years ago

My tensorflow version is 1.4.0

Ayesha-Rafiq commented 6 years ago

mhex???

HRamses commented 6 years ago

Hi! Could you try to change to a more recent version of tf? we had to adapt the code for newer tf versions - so hopefully this will fix the problem.

Ayesha-Rafiq commented 6 years ago

I have tried tensorflow version 1.6 but same error occur

On Friday, August 10, 2018, HRamses notifications@github.com wrote:

Hi! Could you try to change to a more recent version of tf? we had to adapt the code for newer tf versions - so hopefully this will fix the problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bioinf-jku/TTUR/issues/10#issuecomment-412060368, or mute the thread https://github.com/notifications/unsubscribe-auth/AleDwVA2k80HxTPkG2NOqzKJgenvJQ62ks5uPXRCgaJpZM4V3lcS .

Ayesha-Rafiq commented 6 years ago

When i compute fid seperatly. Then it works fine. But when i try to compute fid during training of dcgan then this error occur. please help me.

On Friday, August 10, 2018, AYESHA RAFIQUE mscsf16m020@pucit.edu.pk wrote:

I have tried tensorflow version 1.6 but same error occur

On Friday, August 10, 2018, HRamses notifications@github.com wrote:

Hi! Could you try to change to a more recent version of tf? we had to adapt the code for newer tf versions - so hopefully this will fix the problem.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bioinf-jku/TTUR/issues/10#issuecomment-412060368, or mute the thread https://github.com/notifications/unsubscribe-auth/AleDwVA2k80HxTPkG2NOqzKJgenvJQ62ks5uPXRCgaJpZM4V3lcS .

byeongkeun-kang commented 6 years ago

I have the same problem (both this and #8). @HRamses, Could you tell me the version of Tensorflow you have tested?

HRamses commented 6 years ago

I tested it with version 1.8.0. But I tested it only on an separate data set and not while training. I will try to reproduce the error.

Ayesha-Rafiq commented 6 years ago

I have also tried tensorflow version 1.8.0. but same error occur.

On Mon, Aug 13, 2018 at 1:44 PM, HRamses notifications@github.com wrote:

I testet it with version 1.8.0

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bioinf-jku/TTUR/issues/10#issuecomment-412449128, or mute the thread https://github.com/notifications/unsubscribe-auth/AleDwa-P9Cy1f401M-UeegV2EynJwZ0nks5uQTyHgaJpZM4V3lcS .

mhex commented 6 years ago

It looks like the code is not compatible anymore with the recent Python, Numpy? and Tensorflow versions. We need some time to sort this out.

untom commented 6 years ago

If you need a more short-term solution, please note that you can use the FID implementation from tensorflow contrib: https://www.tensorflow.org/api_docs/python/tf/contrib/gan/eval/frechet_classifier_distance

paruby commented 6 years ago

I also got this error using TF version 1.10 and python version 3.6.

I haven't tested this, but a fix that stops things from crashing and seems to give correct numbers is to replace line 54:

if shape._dims != []:

with:

if shape._dims != [] and (shape._dims is not None):