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

conv2d() got an unexpected keyword argument 'border_mode' #11

Closed Mageshwaran2314 closed 5 years ago

Mageshwaran2314 commented 6 years ago

Hi help me to rectify 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 "E:\sam-master\models.py", line 136, in sam_resnet nb_cols=3, nb_rows=3)(att_convlstm) File "C:\ProgramData\Anaconda3\lib\site-packages\keras\engine\topology.py", line 617, in call output = self.call(inputs, **kwargs) File "E:\sam-master\attentive_convlstm.py", line 143, in call initial_states = self.get_initial_states(x) File "E:\sam-master\attentive_convlstm.py", line 42, in get_initial_states initial_state = K.conv2d(initial_state, K.zeros((self.nb_filters_out, self.nb_filters_in, 1, 1)), border_mode='same') TypeError: conv2d() got an unexpected keyword argument 'border_mode'

marcellacornia commented 6 years ago

Hi @Mageshwaran2314, thanks for downloading our code.

Please check your Keras and Theano versions. Our code is compatible with Keras 1.1.0 and Theano 0.9.0.

Mageshwaran2314 commented 6 years ago

yes I try to run this code with keras 2.1.3

I made some changes to the code, after that, I got this error

Using Theano backend. Traceback (most recent call last): File "main.py", line 63, in m = Model(input=[x, x_maps], output=sam_resnet([x, x_maps])) File "E:\sam-master\models.py", line 130, in sam_resnet dcn = dcn_resnet(input_tensor=x[0]) File "E:\sam-master\dcn_resnet.py", line 143, in dcn_resnet x = conv_block(x, 3, [64, 64, 256], stage=2, block='a', strides=(1, 1)) File "E:\sam-master\dcn_resnet.py", line 50, in conv_block name=conv_name_base + '2a')(input_tensor) File "C:\ProgramData\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 56, in wrapper raise_duplicate_arg_error(old_name, new_name) File "C:\ProgramData\Anaconda3\lib\site-packages\keras\legacy\interfaces.py", line 106, in raise_duplicate_arg_error '' + new_arg + '. Stick to the latter!') TypeError: For the strides argument, the layer received both the legacy keyword argument subsample and the Keras 2 keyword argument strides. Stick to the latter!

Help me with this

marcellacornia commented 6 years ago

It seems that you are still using Keras 2.

You have to check your keras.json file. It should be in the following format:

{
    "image_dim_ordering": "th", 
    "epsilon": 1e-07, 
    "floatx": "float32", 
    "backend": "theano"
}
Mageshwaran2314 commented 6 years ago

already I change this { "floatx": "float32", "epsilon": 1e-07, "image_dim_ordering": "th", "backend": "theano" }

ghost commented 6 years ago

Traceback (most recent call last): File "/home/bl/PycharmProjects/Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model/main.py", line 66, in m = Model(input=[x, x_maps], output=sam_vgg([x, x_maps])) File "/home/bl/PycharmProjects/Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model/models.py", line 107, in sam_vgg nb_cols=3, nb_rows=3)(att_convlstm) File "/usr/local/lib/python2.7/dist-packages/Keras-2.0.3-py2.7.egg/keras/engine/topology.py", line 578, in call output = self.call(inputs, **kwargs) File "/home/bl/PycharmProjects/Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model/attentive_convlstm.py", line 143, in call initial_states = self.get_initial_states(x) File "/home/bl/PycharmProjects/Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model/attentive_convlstm.py", line 42, in get_initial_states initial_state = K.conv2d(initial_state, K.zeros((self.nb_filters_out, self.nb_filters_in, 1, 1)), border_mode='same') TypeError: conv2d() got an unexpected keyword argument 'border_mode' why?

ghost commented 6 years ago

import keras print keras.version import theano as th print th.version

2.0.3 0.8.2

ghost commented 6 years ago

Traceback (most recent call last): File "/home/bl/PycharmProjects/Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model/main.py", line 77, in m = Model(input=[x, x_maps], output=sam_resnet([x, x_maps])) File "/home/bl/PycharmProjects/Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model/models.py", line 136, in sam_resnet nb_cols=3, nb_rows=3)(att_convlstm) File "/usr/local/lib/python2.7/dist-packages/Keras-2.0.3-py2.7.egg/keras/engine/topology.py", line 578, in call output = self.call(inputs, **kwargs) File "/home/bl/PycharmProjects/Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model/attentive_convlstm.py", line 147, in call initial_states = self.get_initial_states(x) File "/home/bl/PycharmProjects/Predicting Human Eye Fixations via an LSTM-based Saliency Attentive Model/attentive_convlstm.py", line 43, in get_initial_states initial_state = K.conv2d(initial_state, K.zeros((self.nb_filters_out, self.nb_filters_in, 1, 1)), padding='same') File "/usr/local/lib/python2.7/dist-packages/Keras-2.0.3-py2.7.egg/keras/backend/tensorflow_backend.py", line 2921, in conv2d data_format='NHWC') File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/nn_ops.py", line 650, in convolution num_spatial_dims])) ValueError: number of input channels does not match corresponding dimension of filter, 512 != 1

kfzyqin commented 5 years ago

initial_state = K.conv2d(initial_state, K.zeros((self.nb_filters_out, self.nb_filters_in, 1, 1)), padding='same') This solves the issue