coxlab / prednet

Code and models accompanying "Deep Predictive Coding Networks for Video Prediction and Unsupervised Learning"
https://arxiv.org/abs/1605.08104
MIT License
759 stars 259 forks source link

keras 2.0.1 #13

Closed juliojj closed 7 years ago

juliojj commented 7 years ago

Hi, I adapted your code to my needs and it was working perfectly until I installed the latest keras version (2.0.1). Did some of you tried to run prednet with keras 2.0? The error I am getting is the following (even if I use 'th' or 'tf'). Any suggestion to fix that will be very appreciated. Thanks a lot.


/usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py:86: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(1, (3, 3), padding="same", activation=<function ..., data_format="channels_last") 'call to the Keras 2 API: ' + signature) /usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py:86: UserWarning: Update yourConv2Dcall to the Keras 2 API:Conv2D(1, (3, 3), padding="same", activation="relu", data_format="channels_last") ' call to the Keras 2 API: ' + signature) /usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py:86: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(48, (3, 3), padding="same", activation=<function ..., data_format="channels_last") 'call to the Keras 2 API: ' + signature) /usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py:86: UserWarning: Update yourConv2Dcall to the Keras 2 API:Conv2D(96, (3, 3), padding="same", activation=<function ..., data_format="channels_last") ' call to the Keras 2 API: ' + signature) /usr/local/lib/python2.7/dist-packages/keras/legacy/interfaces.py:86: UserWarning: Update your Conv2D call to the Keras 2 API: Conv2D(192, (3, 3), padding="same", activation=<function ..., data_format="channels_last") '` call to the Keras 2 API: ' + signature) Traceback (most recent call last): File "predictSpatioTemporal.py", line 267, in cache_dir=cache_dir) File "predictSpatioTemporal.py", line 173, in predictSpatioTemporal train_prednet_model() File "code/chalearn_train.py", line 71, in train_prednet_model errors = prednet(inputs) # errors will be (batch_size, nt, nb_layers) File "/usr/local/lib/python2.7/dist-packages/keras/layers/recurrent.py", line 252, in call return super(Recurrent, self).call(inputs, **kwargs) File "/usr/local/lib/python2.7/dist-packages/keras/engine/topology.py", line 528, in call self.build(input_shapes[0]) File "code/prednet.py", line 196, in build if self.initial_weights is not None: AttributeError: 'PredNet' object has no attribute 'initial_weights'

bill-lotter commented 7 years ago

Hi, I haven't updated for Keras 2.0 yet but hope to do so in the not-too-distant future.

yaxiongchi commented 7 years ago

I met the same problem

Keson96 commented 7 years ago

Met the same problem with Keras 2.0 I downgraded to Keras 1.2.0 and Tensorflow 0.12.1, still got following error

ValueError: Dimension 0 in both shapes must be equal, but are 32 and 16 for 'concat_5' (op: 'Concat') with input shapes: [], [?,3,128,160], [?,48,64,80], [?,96,32,40], [?,192,16,20], [?,3,128,160], [?,48,64,80], [?,96,32,40], [?,192,16,20], [?,6,128,160], [?,96,64,80], [?,192,32,40], [?,384,16,20].

I haven't tried using python 2.7 because Tensorflow only has python 3.5 support on windows. Is this error related with Python version? Any suggestion will be appreciated. Thanks a lot.

youxiangyien commented 7 years ago

I met the same problem,have you found a solution?

cpaxton commented 7 years ago

At least for me, I only needed a couple minor changes to get training to work with Keras 2.0: https://github.com/cpaxton/prednet/commit/b25db2a12ebbc13ca635759de9e925600fc79108

bill-lotter commented 7 years ago

It's now compatible with Keras 2.0 (cc76248). Thanks for the patience and let me know if you run into any issues with it!