with open('2model.json','r') as f:
json = f.read()
model = model_from_json(json)
model.load_weights("color_tensorflow_real_mode.h5")
Run Code Online (Sandbox Code Playgroud)
我在Google Colab上训练了一个Keras模型。现在无法将其本地加载到我的系统上。收到此错误:ValueError:未知的初始值设定项:GlorotUniform
如何解决呢?每次我在colab上制作模型并尝试在本地加载时,我都无法这样做。收到此错误消息:
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
<ipython-input-17-c3ed162a8277> in <module>()
----> 1 model = model_from_json(json)
2 model.load_weights("color_tensorflow_real_mode.h5")
~\Anaconda3\lib\site-packages\tensorflow\python\keras\engine\saving.py in model_from_json(json_string, custom_objects)
349 config = json.loads(json_string)
350 from tensorflow.python.keras.layers import deserialize # pylint: disable=g-import-not-at-top
--> 351 return deserialize(config, custom_objects=custom_objects)
352
353
~\Anaconda3\lib\site-packages\tensorflow\python\keras\layers\serialization.py in deserialize(config, custom_objects)
62 module_objects=globs,
63 custom_objects=custom_objects,
---> 64 printable_module_name='layer')
~\Anaconda3\lib\site-packages\tensorflow\python\keras\utils\generic_utils.py in deserialize_keras_object(identifier, module_objects, custom_objects, printable_module_name)
171 custom_objects=dict(
172 list(_GLOBAL_CUSTOM_OBJECTS.items()) +
--> 173 list(custom_objects.items())))
174 …Run Code Online (Sandbox Code Playgroud)