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

About error in concat #8

Closed jackyhkust closed 6 years ago

jackyhkust commented 6 years ago

Hi, I am trying to run your code with the CAT2000 data. However, I receive this error.

Traceback (most recent call last): File "main.py", line 63, in m = Model(input=[x, x_maps], output=sam_resnet([x, x_maps])) File "/home/jacky/sam/models.py", line 140, in sam_resnet concateneted = merge([att_convlstm, priors1], mode='concat', concat_axis=1) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1528, in merge name=name) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 1186, in init node_indices, tensor_indices) File "/usr/local/lib/python2.7/dist-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)]

I have set my library as the same as the requirement, which is Theano==0.9 and Keras==1.1.

Please advise. Thanks a lot.

marcellacornia commented 6 years ago

Hi @jackyhkust, thanks for downloading our code.

Have you checked the keras.json file? It should be in the following format: { "image_dim_ordering": "th", "epsilon": 1e-07, "floatx": "float32", "backend": "theano" }

back-kh commented 6 years ago

hello @marcellacornia I have similar issue but when i changed "image_dim_ordering": "th" in keras.json follow this : { "floatx": "float32", "epsilon": 1e-07, "backend": "theano", "image_data_format": "channels_last", "image_dim_ordering": "th" } i got this error : Using Theano backend. /home/nimol/venv3/lib/python3.6/site-packages/keras/backend/theano_backend.py:1282: UserWarning: DEPRECATION: the 'ds' parameter is not going to exist anymore as it is going to be replaced by the parameter 'ws'. mode='max') /home/nimol/venv3/lib/python3.6/site-packages/keras/backend/theano_backend.py:1282: UserWarning: DEPRECATION: the 'st' parameter is not going to exist anymore as it is going to be replaced by the parameter 'stride'. mode='max') /home/nimol/venv3/lib/python3.6/site-packages/keras/backend/theano_backend.py:1282: UserWarning: DEPRECATION: the 'padding' parameter is not going to exist anymore as it is going to be replaced by the parameter 'pad'. mode='max') Compiling SAM-ResNet Traceback (most recent call last): File "main.py", line 119, in raise NotImplementedError NotImplementedError

My keras : 1.1.0 and theano 0.9

i am waiting your help .Thank you

marcellacornia commented 6 years ago

Hi @Thuonnimol, thanks for downloading our code.

First, you have to remove "image_data_format": "channels_last" from your keras.json file.

The NotImplementedError is probably due to a wrong parameter when running the code. For testing, the correct format is: python main.py test path/to/images/folder/ where path/to/images/folder/ is the path of a folder containing the images for which you want to calculate the saliency maps.

back-kh commented 6 years ago

hello @marcellacornia thank you for your answer . Now,i will try

back-kh commented 6 years ago

Hello @marcellacornia now it's working ,thank you