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

visualize() not able to save the image #119

Closed
asispatra opened this issue Feb 22, 2017 · 7 comments
Closed

visualize() not able to save the image #119

asispatra opened this issue Feb 22, 2017 · 7 comments

Comments

@asispatra
Copy link
Contributor

Getting the following error during run:

Traceback (most recent call last):
  File "main.py", line 96, in <module>
    tf.app.run()
  File "....../tensorflow/python/platform/app.py", line 44, in run
    _sys.exit(main(_sys.argv[:1] + flags_passthrough))
  File "main.py", line 93, in main
    visualize(sess, dcgan, FLAGS, OPTION)
  File "...../DCGAN-tensorflow/utils.py", line 174, in visualize
    save_images(samples, [8, 8], './samples/test_arange_%s.png' % (idx))
  File "....../DCGAN-tensorflow/utils.py", line 26, in save_images
    return imsave(inverse_transform(images), size, image_path)
  File "....../DCGAN-tensorflow/utils.py", line 47, in imsave
    return scipy.misc.imsave(path, merge(images, size))
  File "....../DCGAN-tensorflow/utils.py", line 43, in merge
    img[j*h:j*h+h, i*w:i*w+w, :] = image
ValueError: could not broadcast input array from shape (64,64,3) into shape (0,64,3)

@asispatra
Copy link
Contributor Author

visualize() is working if the batch-size <= 64. More than 64 is failing.

@carpedm20
Copy link
Owner

That's why I manually set the number of images to be visualize as 8x8 as https://github.com/carpedm20/DCGAN-tensorflow/blob/master/utils.py#L156. You can change this 8, 8 or 64 values in utils.py to make it work for batch_size > 64

@asispatra
Copy link
Contributor Author

Thanks @carpedm20,
Yes, that's right. I have also arrived at the same place while I was debugging. I will try to find a way to set these sizes automatically based on batch-size.

@asispatra
Copy link
Contributor Author

The following changes resolve my issue:

image_frame_dim = int(math.ceil(config.batch_size**.5))
save_images(samples, [image_frame_dim, image_frame_dim], './samples/test_arange_%s.png' % (idx))

@asispatra
Copy link
Contributor Author

Fixed by #122

@rp2017
Copy link

rp2017 commented Sep 5, 2017

@asispatra can you generate more than 100 images?? Help needed

@asispatra
Copy link
Contributor Author

@rp2017, I have made one PR #216 , I have tested only for "OPTION = 1" as specified in main.py. Please verify for other possible value of OPTION.

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

3 participants