先に保存していた モデル fashion_mnist.h5 を読み込む:
(venv) $ python
>>> from tensorflow.python.keras.models import load_model
>>> model = load_model('./fashion_mnist.h5')
Traceback (most recent call last):
File "", line 1, in
File "/home/pi/venv/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/
save.py", line 146, in load_model
return hdf5_format.load_model_from_hdf5(filepath, custom_objects, compile)
File "/home/pi/venv/lib/python3.7/site-packages/tensorflow_core/python/keras/saving/
hdf5_format.py", line 166, in load_model_from_hdf5
model_config = json.loads(model_config.decode('utf-8'))
AttributeError: 'str' object has no attribute 'decode'
ネット検索で調べた限りでは,現時点でこのエラーの解決策はないようである。
h5py のバージョンをいまの最新 (3.2.1) から 2.10.0 に変更するという論もあるが,これをすると,モデルのロードに先立つところの,モジュール load_model の import でエラーになる。
|