Got an error in running load model
jeremykid opened this issue · 3 comments
jeremykid commented
Hello Antonio,
I downloaded mode: model.hdf5 and
test_data: ecg_tracings.hdf5
Here is my python library version:
Package Version
-------------------- ------------
absl-py 0.9.0
astor 0.8.1
cycler 0.10.0
gast 0.2.2
google-pasta 0.2.0
grpcio 1.28.1
h5py 2.10.0
joblib 0.14.1
Keras 2.1.6
Keras-Applications 1.0.8
Keras-Preprocessing 1.1.0
kiwisolver 1.1.0
Markdown 3.2.1
matplotlib 3.0.3
numpy 1.18.3
opt-einsum 3.2.1
pandas 0.24.2
pip 20.1
pkg-resources 0.0.0
protobuf 3.11.3
pyparsing 2.4.7
python-dateutil 2.8.1
pytz 2020.1
PyYAML 5.3.1
scikit-learn 0.22.2.post1
scipy 1.4.1
seaborn 0.9.1
setuptools 46.1.3
six 1.14.0
tensorboard 1.15.0
tensorflow 1.15.2
tensorflow-estimator 1.15.1
termcolor 1.1.0
tqdm 4.45.0
Werkzeug 1.0.1
wheel 0.34.2
wrapt 1.12.1
xarray 0.12.3
xmljson 0.2.1
When I run predict.py
python3 predict.py --tracings ecg_tracings.hdf5 --model model.hdf5 --output_file output
It return the following error:
Traceback (most recent call last):
File "predict.py", line 32, in <module>
model = load_model(args.model, compile=False)
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/models.py", line 270, in load_model
model = model_from_config(model_config, custom_objects=custom_objects)
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/models.py", line 347, in model_from_config
return layer_module.deserialize(config, custom_objects=custom_objects)
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer')
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/utils/generic_utils.py", line 144, in deserialize_keras_object
list(custom_objects.items())))
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/engine/topology.py", line 2525, in from_config
process_layer(layer_data)
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/engine/topology.py", line 2511, in process_layer
custom_objects=custom_objects)
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/layers/__init__.py", line 55, in deserialize
printable_module_name='layer')
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/utils/generic_utils.py", line 146, in deserialize_keras_object
return cls.from_config(config['config'])
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/engine/topology.py", line 1271, in from_config
return cls(**config)
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/legacy/interfaces.py", line 91, in wrapper
return func(*args, **kwargs)
File "/media/cvc/e82f78f6-bf9e-4253-912b-799fdd6c7d15/automatic-ecg-diagnosis/auto-ecg/lib/python3.5/site-packages/keras/layers/convolutional.py", line 337, in __init__
**kwargs)
TypeError: __init__() got multiple values for keyword argument 'data_format'
Have you met the similar issues or do you have any ideas?
Best wishes
antonior92 commented
Thank you for reporting that @jeremykid
Indeed, I messed up with the requirements. Updating Keras to 2.2.4 should fix the problem. I updated requirements.txt and the README accordingly.
antonior92 commented
Just let me know if the problem persists
jeremykid commented
Hello Antonio,
I think the problem solved, Thank you so much, it is an really good repo, I closed this issue.