osh / KerasGAN

A couple of simple GANs in Keras
501 stars 177 forks source link

Concatenation: Input array dimensions #5

Closed kutoga closed 7 years ago

kutoga commented 7 years ago

Hello

I always get this error:

Traceback (most recent call last):
  File "mnist_gan.py", line 147, in <module>
    X = np.concatenate((XT, generated_images), 1)
ValueError: all the input array dimensions except for the concatenation axis must match exactly

Then i inserted these two prints:

# Pre-train the discriminator network ...
noise_gen = np.random.uniform(0,1,size=[XT.shape[0],100])
generated_images = generator.predict(noise_gen)
print XT.shape
print generated_images.shape
X = np.concatenate((XT, generated_images), 1)

And i get this output:

(10000, 1, 28, 28)
(10000, 400, 28, 1)

Unfortunately i never used keras.

Maybe someone know how this can be fixed?

Thank you very much

muxspace commented 7 years ago

Check your keras.json for the image_dim_ordering ordering propery in keras.json and make sure it's th. The default is tf for TensorFlow.

kutoga commented 7 years ago

This fixed it:) Thanks!