imatge-upc / detection-2016-nipsws

Hierarchical Object Detection with Deep Reinforcement Learning
http://imatge-upc.github.io/detection-2016-nipsws/
MIT License
423 stars 129 forks source link

which keras backend are you using? #1

Closed gaopeng-eugene closed 7 years ago

gaopeng-eugene commented 7 years ago

I am trying to run your code with theano backended keras. However, I run into the following error.

Using Theano backend. Couldn't import dot_parser, loading of dot files will not be possible. Using gpu device 0: Tesla K80 (CNMeM is disabled, cuDNN 4007) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) (Subtensor{int64}.0, Elemwise{add,no_inplace}.0, Elemwise{add,no_inplace}.0, Subtensor{int64}.0) Traceback (most recent call last): File "image_zooms_testing.py", line 41, in model_vgg = obtain_compiled_vgg_16(path_vgg) File "/data/scratch/gaop/deep_reinforcement/detection-2016-nipsws/scripts/features.py", line 203, in obtain_compiled_vgg_16 model = vgg_16(vgg_weights_path) File "/data/scratch/gaop/deep_reinforcement/detection-2016-nipsws/scripts/features.py", line 247, in vgg_16 model.add(Flatten()) File "/home/gaop/env/local/lib/python2.7/site-packages/keras/models.py", line 312, in add output_tensor = layer(self.outputs[0]) File "/home/gaop/env/local/lib/python2.7/site-packages/keras/engine/topology.py", line 514, in call self.add_inbound_node(inbound_layers, node_indices, tensor_indices) File "/home/gaop/env/local/lib/python2.7/site-packages/keras/engine/topology.py", line 572, in add_inbound_node Node.create_node(self, inbound_layers, node_indices, tensor_indices) File "/home/gaop/env/local/lib/python2.7/site-packages/keras/engine/topology.py", line 152, in create_node output_shapes = to_list(outbound_layer.get_output_shape_for(input_shapes[0])) File "/home/gaop/env/local/lib/python2.7/site-packages/keras/layers/core.py", line 402, in get_output_shape_for '(got ' + str(input_shape[1:]) + '. ' Exception: The shape of the input to "Flatten" is not fully defined (got (0, 7, 512). Make sure to pass a complete "input_shape" or "batch_input_shape" argument to the first layer in your model.

miriambellver commented 7 years ago

hi!

I am also using Theano backend, I can tell you the versions that I used in case this is the problem:

Keras: 1.1.0 Theano: 0.9.0.dev2 cuda/7.5 CUDNN/5.1.3

gaopeng-eugene commented 7 years ago

Thanks for your quick reply and amazing project.

Can you tell me the command to install theano:0.9.0.dev2?

I can only install keras 1.1.0 by pip install keras==1.1.0 but not theano==0.9.0.dev2

gaopeng-eugene commented 7 years ago

Could not find a version that satisfies the requirement theano==0.9.0.dev2 (from versions: 0.8.0, 0.4.0, 0.4.0rc3, 0.4.0rc1, 0.4.1, 0.8.0rc1, 0.4.1rc1, 0.8.2, 0.7.0rc1, 0.3.0rc4, 0.5.0rc2, 0.6.0, 0.5.0rc1, 0.3.0, 0.4.0, 0.4.1rc2, 0.4.1, 0.4.1rc2, 0.6.0rc5, 0.6.0rc3, 0.8.0rc1, 0.7.0, 0.6.0rc5, 0.5.0, 0.6.0rc2, 0.7.0rc2, 0.4.0rc4, 0.8.0, 0.7.0, 0.6.0rc3, 0.3.0rc4, 0.7.0rc1, 0.3.1rc2, 0.4.0rc1, 0.3.1, 0.4.0rc2, 0.4.0rc4, 0.6.0rc2, 0.7.0rc2, 0.5.0rc2, 0.6.0, 0.5.0, 0.4.1rc1, 0.3.1rc1, 0.4.0rc3, 0.5.0rc1, 0.3.1rc1, 0.8.1, 0.3.1rc2, 0.6.0rc1, 0.6.0rc1, 0.3.0, 0.4.0rc2, 0.3.1, 0.8.1)

miriambellver commented 7 years ago

Actually I tested the code in two different environments. Maybe it will be easier to test it on the other configuration that worked for me, in this case I used:

Theano (0.8.2) Keras (1.0.8)

gaopeng-eugene commented 7 years ago

Thank you so much. It turned out version is not the problem. There is some mistake in my ~/.keras/keras.json setting. When change backend, change "image_dim_ordering" and "backend" together. For theano '{ "image_dim_ordering": "th", "epsilon": 1e-07, "floatx": "float32", "backend": "theano" }'

For tensorflow '{ "image_dim_ordering": "tf", "epsilon": 1e-07, "floatx": "float32", "backend": "tensorflow" }'