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

SRGAN: ValueError: Input 0 of layer fc1 is incompatible with the layer: expected axis -1 of input shape to have value 25088 but received input with shape [None, 32768] #235

Open
protoneqt opened this issue Aug 14, 2020 · 1 comment

Comments

@protoneqt
Copy link

When I run srgan.py, I have the following error:

WARNING:tensorflow:Model was constructed with shape (None, 224, 224, 3) for input Tensor("input_1:0", shape=(None, 224, 224, 3), dtype=float32), but it was called on an input with incompatible shape (None, 256, 256, 3).
Traceback (most recent call last):
  File "E:/home/projects/deblur/git/Keras-GAN/srgan/srgan.py", line 272, in <module>
    gan = SRGAN()
  File "E:/home/projects/deblur/git/Keras-GAN/srgan/srgan.py", line 51, in __init__
    self.vgg = self.build_vgg()
  File "E:/home/projects/deblur/git/Keras-GAN/srgan/srgan.py", line 114, in build_vgg
    img_features = vgg(img)
  File "E:\home\projects\main\git\enp\venv2\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 922, in __call__
    outputs = call_fn(cast_inputs, *args, **kwargs)
  File "E:\home\projects\main\git\enp\venv2\lib\site-packages\tensorflow\python\keras\engine\network.py", line 719, in call
    convert_kwargs_to_constants=base_layer_utils.call_context().saving)
  File "E:\home\projects\main\git\enp\venv2\lib\site-packages\tensorflow\python\keras\engine\network.py", line 888, in _run_internal_graph
    output_tensors = layer(computed_tensors, **kwargs)
  File "E:\home\projects\main\git\enp\venv2\lib\site-packages\tensorflow\python\keras\engine\base_layer.py", line 886, in __call__
    self.name)
  File "E:\home\projects\main\git\enp\venv2\lib\site-packages\tensorflow\python\keras\engine\input_spec.py", line 216, in assert_input_compatibility
    ' but received input with shape ' + str(shape))
ValueError: Input 0 of layer fc1 is incompatible with the layer: expected axis -1 of input shape to have value 25088 but received input with shape [None, 32768]

Process finished with exit code 1

@lbj96347
Copy link

lbj96347 commented Sep 12, 2020

Well, I met the same issue with you. I thought it was caused by incompatible versions of Keras & Tensorflow. I used to use the latest version of tensorflow on macOS, the same error message came out.

I reinstalled Keras==2.0.6 & Tensorflow==1.15.0, it works fine now.

Hope it could help you.

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

2 participants