Closed lukovkin closed 8 years ago
Hmm, seems to be different on release 0.3.2 and current working branch of Keras. On release version 0.3.2 will give the following error:
TypeError: unsupported operand type(s) for +: 'NoneType' and 'int'
Looks like should be working with input_shape=(None, features), but then fails on different error:
model.add_node(ParametricSoftplus(), name='relu1', input='conv1') TypeError: an integer is required
Probably will be working with simple ReLU, not tested yet, will update later.
OK, it works, at least technically, on current master branch of Keras (not on 0.3.2) and on Theano 0.8.0.rc1 and TensorFlow with ReLU activations, gist is here - https://gist.github.com/lukovkin/8d8d9994ecc20914b884#file-fcn_model_working-py.
On ParametricSoftplus activation gives abovementioned error.
I think usage of input_shape to allow arbitrary inputs should be documented in more details. I could try to add something to docs about it.
SReLU fails with the same message.
Probably Advanced Activations with weights are not able to process input_shape with None because of the implementation of the 'build' method. E.g. it fails at:
self.alphas = K.variable(self.alpha_init * np.ones(input_shape), name='{}_alphas'.format(self.name)) self.betas = K.variable(self.beta_init * np.ones(input_shape), name='{}_betas'.format(self.name))
OK, original issue is resolved, bug with advanced activations it's better to create as separate issue.
Trying to implement 1D fully convolutional network in Keras (within the UFCNN implementation, inspired by arXiv:1508.00317v1 [stat.ML] ). One of ideas was to use approach described here - http://cs231n.github.io/convolutional-networks/#convert (and probably used by Roni too) in order to improve computational efficiency (to avoid iterating through the input sequence with a step=1). We found earlier discussion on FCN in Keras, but it seems to be designed for much earlier version - https://github.com/fchollet/keras/issues/356.
Model generation code is here: https://gist.github.com/lukovkin/8d8d9994ecc20914b884 It compiles OK, but when I try to pass to the 'fit' function input/output data shaped like:
X.shape (1, 53353, 4) y.shape (1, 53353, 3)
I get the following error: on Theano 0.8.0.dev0 and Python 2.7on Theano 0.8.0.rc1 and Python 3.5
Are there any ideas how to make Keras apply convolution to the sequence larger than input of convolution layer? - Or, rephrasing, how to use input of arbitrary length?