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

ValueError: Cannot feed value of shape (64, 218, 178, 3) for Tensor 'real_images:0', which has shape '(64, 64, 64, 3)' #373

Open kazad123 opened 4 years ago

kazad123 commented 4 years ago

I am getting the following error when trying to train the model using the celebA dataset. Load fails to find a checkpoint, which makes sense since there are no checkpoints. Then the following error occurs. I have pasted some of the last output along with the stacktrace. I would appreciate any and all help

  Total size of variables: 9451908
    Total bytes of variables: 37807632
     [*] Reading checkpoints... ./out\20200116.161511 - data - celebA -x108.z100.uniform_signed.y64.b64\checkpoint
     [*] Failed to find a checkpoint
     [!] Load failed...
Traceback (most recent call last):
  File "main.py", line 147, in <module>
    tf.app.run()
  File "C:\Users\...\.conda\envs\py3\lib\site-packages\tensorflow\python\platform\app.py", line 125, in run
    _sys.exit(main(argv))
  File "main.py", line 120, in main
    dcgan.train(FLAGS)
  File "C:\Users\...\Documents\DCGAN-tensorflow-master\model.py", line 279, in train
    feed_dict={ self.inputs: batch_images, self.z: batch_z })
  File "C:\Users\...\.conda\envs\py3\lib\site-packages\tensorflow\python\client\session.py", line 929, in run
    run_metadata_ptr)
  File "C:\Users\...\.conda\envs\py3\lib\site-packages\tensorflow\python\client\session.py", line 1128, in _run
    str(subfeed_t.get_shape())))
ValueError: Cannot feed value of shape (64, 218, 178, 3) for Tensor 'real_images:0', which has shape '(64, 64, 64, 3)'

Thank you

rajendrac3 commented 4 years ago

To resolve this:

add img_bgr = cv2.resize(img_bgr, (200, 200)) in utils.py after img_bgr = cv2.imread(path)

aseem-thakkar commented 4 years ago

@rajendrac3

I added img_bgr = cv2.resize(img_bgr, (64, 64)) instead of img_bgr = cv2.resize(img_bgr, (200, 200))

And it worked for me