osh / KerasGAN

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

Can't train the model #8

Closed adamluo1995 closed 7 years ago

adamluo1995 commented 7 years ago

Hi , i am a student who have a lot interesting in Deep Learning. I try to run mnist_gan.py in project but trigger an assertion in keras/layers/core.py. here is the details:

Traceback (most recent call last): File "/home/hadoop/GAN_test/KerasGAN/mnist_gan.py", line 113, in gan_V = discriminator(H) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 569, in call self.add_inbound_node(inbound_layers, node_indices, tensor_indices) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 632, in add_inbound_node Node.create_node(self, inbound_layers, node_indices, tensor_indices) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 164, in create_node output_tensors = to_list(outbound_layer.call(input_tensors[0], mask=input_masks[0])) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2240, in call output_tensors, output_masks, output_shapes = self.run_internal_graph(inputs, masks) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 2413, in run_internal_graph shapes = to_list(layer.get_output_shape_for(computed_tensors[0]._keras_shape)) File "/usr/local/lib/python2.7/dist-packages/keras/layers/core.py", line 775, in get_output_shape_for assert input_shape[-1] and input_shape[-1] == self.input_dim AssertionError

Would you tell me how can i fix it? Thanks:)

theFool32 commented 7 years ago

You may need to change image_dim_ordering to th instead of tf Keras backend mentions two ways to achieve it.

adamluo1995 commented 7 years ago

It works ! Thank you theFool32 !There are still some other problems but i can handle them:)

ParthaEth commented 7 years ago

Could you either post the errors or close the issue?

angadgill commented 7 years ago

I had the same issue. Adding "image_dim_ordering": "th" to ~/.keras/keras.json fixed it!