marcellacornia / sam

Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model. IEEE Transactions on Image Processing (2018)
https://ieeexplore.ieee.org/document/8400593
MIT License
205 stars 76 forks source link

Exception: "concat" mode can only merge layers with matching output shapes #5

Closed RutenburgIG closed 6 years ago

RutenburgIG commented 6 years ago

Hello, I'm trying to test network on sample images from repo with: python main.py test sample_images/

But got this error:

Traceback (most recent call last):
  File "main.py", line 63, in <module>
    m = Model(input=[x, x_maps], output=sam_resnet([x, x_maps]))
  File "/beegfs/120x/home/ilia/_res_arch/sam/models.py", line 140, in sam_resnet
    concateneted = merge([att_convlstm, priors1], mode='concat', concat_axis=1)
  File "/beegfs/120x/home/ilia/Theano/local/lib/python2.7/site-packages/keras/engine/topology.py", line 1528, in merge
    name=name)
  File "/beegfs/120x/home/ilia/Theano/local/lib/python2.7/site-packages/keras/engine/topology.py", line 1186, in __init__
    node_indices, tensor_indices)
  File "/beegfs/120x/home/ilia/Theano/local/lib/python2.7/site-packages/keras/engine/topology.py", line 1253, in _arguments_validation
    'Layer shapes: %s' % (input_shapes))
Exception: "concat" mode can only merge layers with matching output shapes except for the concat axis. Layer shapes: [(None, 512, 30, 512), (None, 16, 30, 40)]
zhiyuancao commented 6 years ago

@marcellacornia I got the same error

marcellacornia commented 6 years ago

Hi @RutenburgIG and @zhiyuancao, thanks for downloading our code.

Are you running the code with Keras 1.1.0? Unfortunately, this code is not compatible with Keras 2. Also, have you set the dim ordering to "th" in the keras.json file?

RutenburgIG commented 6 years ago

@marcellacornia, thx, I found, that I haven't change default param name from the newer version of Keras: image_data_format to old one image_dim_ordering Strange, that it doesn't produce an error while parsing params.