Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Ayesha-Rafiq opened this issue Aug 10, 2018 · 13 comments

Comments

@Ayesha-Rafiq
Copy link

No description provided.

@Ayesha-Rafiq
Copy link
Author

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.

@Ayesha-Rafiq Ayesha-Rafiq changed the title Error in computing fid during training.ValueError: Cannot iterate over a shape with unknown rank. Error in computing fid during training. ValueError: Cannot iterate over a shape with unknown rank. Aug 10, 2018
@mhex
Copy link
Collaborator

mhex commented Aug 10, 2018

Hi, which Tensorflow version do you use?

@Ayesha-Rafiq
Copy link
Author

My tensorflow version is 1.4.0

@Ayesha-Rafiq
Copy link
Author

mhex???

@HRamses
Copy link
Collaborator

HRamses commented Aug 10, 2018

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
Copy link
Author

Ayesha-Rafiq commented Aug 10, 2018 via email

@Ayesha-Rafiq
Copy link
Author

Ayesha-Rafiq commented Aug 10, 2018 via email

@byeongkeun-kang
Copy link

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

@HRamses
Copy link
Collaborator

HRamses commented Aug 13, 2018

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
Copy link
Author

Ayesha-Rafiq commented Aug 13, 2018 via email

@mhex
Copy link
Collaborator

mhex commented Aug 13, 2018

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
Copy link
Member

untom commented Aug 13, 2018

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
Copy link

paruby commented Oct 25, 2018

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):

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants