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
210 stars 76 forks source link

Adapting different testing image shapes? #40

Open terrytykuo opened 4 years ago

terrytykuo commented 4 years ago

I got an error below:

Traceback (most recent call last): File "main.py", line 63, in m = Model(input=[x, x_maps], output=sam_resnet([x, x_maps])) File "/Users/Terry/Documents/Memorix/sam-master/models.py", line 140, in sam_resnet concateneted = merge([att_convlstm, priors1], mode='concat', concat_axis=1) File "/Users/Terry/anaconda3/envs/python27/lib/python2.7/site-packages/keras/engine/topology.py", line 1528, in merge name=name) File "/Users/Terry/anaconda3/envs/python27/lib/python2.7/site-packages/keras/engine/topology.py", line 1186, in init node_indices, tensor_indices) File "/Users/Terry/anaconda3/envs/python27/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, 113, 180), (None, 16, 30, 40)]

Is it because of my testing images are 1440x900? If so, How do I configure the input shape of the model?

-- Update I tested pics with

plebreton commented 4 years ago

The issue is you did not set your ~/.keras/keras.json file properly.

You need to have "image_dim_ordering" set to "th".

Note, that there is also another parameter "image_data_format" which comes with more recent version of Keras. You may have changed the wrong one by going quickly into the configuration of the platform ;)