rizkiarm / LipNet

Keras implementation of 'LipNet: End-to-End Sentence-level Lipreading'
MIT License
627 stars 224 forks source link

ValueError: GRU(reset_after=False) is not compatible with GRU(reset_after=True) #109

Closed KPat421 closed 3 years ago

KPat421 commented 3 years ago

I am working on the Raspberry Pi 4, trying to run this for a capstone project. Trying to run predict and receiving the following:

Loading data from disk... Data loaded.

Traceback (most recent call last): File "/home/pi/Desktop/LipNet/evaluation/predict.py", line 60, in video, result = predict(sys.argv[1], sys.argv[2]) File "/home/pi/Desktop/LipNet/evaluation/predict.py", line 44, in predict lipnet.model.load_weights(weight_path) File "/home/pi/venv/lib/python3.7/site-packages/tensorflow/python/keras/engine/training.py", line 250, in load_weights return super(Model, self).load_weights(filepath, by_name, skip_mismatch) File "/home/pi/venv/lib/python3.7/site-packages/tensorflow/python/keras/engine/network.py", line 1266, in load_weights hdf5_format.load_weights_from_hdf5_group(f, self.layers) File "/home/pi/venv/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 711, in load_weights_from_hdf5_group layer, weight_values, original_keras_version, original_backend) File "/home/pi/venv/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 316, in preprocess_weights_for_loading weights = convert_nested_bidirectional(weights) File "/home/pi/venv/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 254, in convert_nested_bidirectional original_keras_version, original_backend) File "/home/pi/venv/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 407, in preprocess_weights_for_loading return _convert_rnn_weights(layer, weights) File "/home/pi/venv/lib/python3.7/site-packages/tensorflow/python/keras/saving/hdf5_format.py", line 568, in _convert_rnn_weights raise ValueError('%s is not compatible with %s' % types) ValueError: GRU(reset_after=False) is not compatible with GRU(reset_after=True)

zhaoshuaitao commented 3 years ago

Hello,have you solved it? I have the same problem.

jainnimish commented 3 years ago

Please downgrade to TensorFlow 1.15 and install all dependencies according to this with this version. This error is occurring probably because you are using TF 2.2 and in that version the tf.keras.layers.GRU is set to reset_after = false. I tried changing it but it wasn't possible. Just ended up downgrading to TF 1.15 and install all other dependencies in sync with that version.

KPat421 commented 3 years ago

Yes, we also ended up doing the same thing and it's working now.

qqq89513 commented 3 years ago

@KPat421 Hi, I am trying to get this repository to work. I can run installation with setup.py without assigning versions of packages. I'm using Python3.7, same as your case. However, I found out that the code is for python2. So I changed any print "xxx" to print("xxx"). Then I passed the syntax check. The other error just popped up:

from scipy.misc import imresize
ImportError: cannot import name 'imresize'

google tells me that imresize is not supported in scipy after version of 1.0.0. But I failed to install scipy 1.0.0 or other versions below.

Any idea how to proceed or start from beginning with python3.7?

KPat421 commented 3 years ago

I got it to work with the following versions: Keras==2.0.2 editdistance==0.5.3 h5py==2.6.0 matplotlib==3.3.3 numpy==1.16.0 python-dateutil==2.6.0 scipy==1.0.1 Pillow==8.0.1 tensorflow==1.14.0 Theano==0.9.0 nltk==3.2.2 sk-video==1.1.10 dlib==19.21.0

qqq89513 commented 3 years ago

@KPat421 Thanks for the instant reply. I get ./evaluation/predict.py work with WSL(Windows Subsystem for Linux) with the following commands:

sudo apt install c++
sudo apt install gcc
sudo apt install cmake
sudo apt install ffmpeg
pip3 install wheel

And for python3, you have to change print "xxx" to print("xxx"). For ./setup.py, I have

    install_requires=[
        'Keras==2.0.2',
        'editdistance==0.5.3',
    'h5py==2.6.0',
    'matplotlib==3.3.3',
    'numpy==1.16.0',
    'python-dateutil==2.6.0',
    'scipy==1.0.1',
    'Pillow==8.0.1',
    'tensorflow==1.14.0',
    'Theano==0.9.0',
        'nltk==3.2.2',
        'sk-video==1.1.10',
        'dlib==19.21.1'
    ]