Open jasper95 opened 8 years ago
seems like a data shape problem, your input data needs to be of shape batch_size x time_len x dim
. The reshape will be done inside the model. Check this example:
https://github.com/EderSantana/seya/blob/master/tests/test_conv_rnn.py#L35-L50
Well, we have different scenario. Your 2D dimension is NxN while mine is MxN
I believe you can reshape to MxN inside the RNN
Try reshape_dim=(1, M, N)
.
I did that already. pls see my code above.
ok, did you also get a reshape problem with ConvRNN. I'm investigating a similar bug on ConvGRU...
Sorry, I couldn't find the Keras version number that seya works with. I tried ConvGRU with Keras 1.1.0 and there are multiple API changes but I'm wondering if at a more fundamental level feeding the input into Keras's Convolutional2D will not work in Keras 1.1.0
I tried to resolve the API changes on my own but encountered this last error (most informative line is ValueError: Filter must not be larger than the input: Filter: (3, 3) Input: (1, 28))
Any feedback would be appreciated - thanks!
File "/usr/local/lib/python2.7/dist-packages/keras/layers/recurrent.py", line 215, in call
input_length=input_shape[1])
File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1246, in rnn
_step.output_size = int(_step(first_input, state)[0].get_shape()[-1])
File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1229, in _step
output, new_states = step_function(input, states + constants)
File "vpnet.py", line 234, in step
xz_t = self.conv_x_z(x_t)
File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 529, in __call__
return self.call(x, mask)
File "/usr/local/lib/python2.7/dist-packages/keras/layers/convolutional.py", line 466, in call
filter_shape=self.W_shape)
File "/usr/local/lib/python2.7/dist-packages/keras/backend/tensorflow_backend.py", line 1579, in conv2d
x = tf.nn.conv2d(x, kernel, strides, padding=padding)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/ops/gen_nn_ops.py", line 394, in conv2d
data_format=data_format, name=name)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/op_def_library.py", line 703, in apply_op
op_def=op_def)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 2319, in create_op
set_shapes_for_outputs(ret)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/ops.py", line 1711, in set_shapes_for_outputs
shapes = shape_func(op)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 246, in conv2d_shape
padding)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 184, in get2d_conv_output_size
(row_stride, col_stride), padding_type)
File "/usr/local/lib/python2.7/dist-packages/tensorflow/python/framework/common_shapes.py", line 149, in get_conv_output_size
"Filter: %r Input: %r" % (filter_size, input_size))
ValueError: Filter must not be larger than the input: Filter: (3, 3) Input: (1, 28)
Guys, perhaps the best way right to use conv-rnns is with this PR to Keras: https://github.com/fchollet/keras/pull/3906
that one is compatible with the most recent version of keras. check it out
@EderSantana Hi, Does the ConvGRU layer suffer from computational speed issue? I have tried the PR mentioned above, the ConvLSTM structure is approximately 10 times slower than the FC-LSTM structure. BR.
yeah convRNNs in general are much slower. you can optimize them to do all convs in one pass, but the states of the networks are multi-channel maps (output of convs) instead of simple vectors. i.e. its a lot stored in memory for backpropagation
I tried using ConvGRU but I'm getting runtime error