bstriner / keras-adversarial

Keras Generative Adversarial Networks
MIT License
867 stars 231 forks source link

cifar_gan_example10.py input shape #28

Closed isaacmg closed 7 years ago

isaacmg commented 7 years ago

When attempting to use the example_gan_cifar10.py I'm getting the following error message ValueError: Error when checking input: expected conv2d_5_input to have shape (None, 32, 32, 3) but got array with shape (50000, 32, 3, 32) I'm using the most recent version of Keras 2.04 and Python 3.6. Prior to this running at all I also had to cast all the floats to ints.

plbecker commented 7 years ago

Replace

history = fit(model, x=dim_ordering_fix(xtrain), y=y, validation_data=(dim_ordering_fix(xtest), ytest),
                  callbacks=callbacks, nb_epoch=nb_epoch,
batch_size=32)

with

history = fit(model, x=xtrain, y=y, validation_data=(xtest, ytest),
                  callbacks=callbacks, nb_epoch=nb_epoch,
                  batch_size=32)

the dim_ordering_fix() function changes the order of the array items and thus is responsible for the error throwing. This is at least what worked for me.

bstriner commented 7 years ago

Thanks for the report! PR is merged so closing the issue.