代码=元帅。loads(raw_code)value error:不良元帅数据(未知类型代码)
运行Flexget Python脚本我会发现一个错误:
Traceback (most recent call last):
File "D:\project\facenet3\FaceRecognition_SVM_Classifier.py", line 51, in <module>
model = load_model('D:/project/facenet3/facenet_keras.h5')
File "C:\Users\tueku\Envs\facenet5\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\tueku\Envs\facenet5\lib\site-packages\keras\utils\generic_utils.py", line 793, in func_load
code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)
Running flexget Python script I get an error:
Traceback (most recent call last):
File "D:\project\facenet3\FaceRecognition_SVM_Classifier.py", line 51, in <module>
model = load_model('D:/project/facenet3/facenet_keras.h5')
File "C:\Users\tueku\Envs\facenet5\lib\site-packages\keras\utils\traceback_utils.py", line 67, in error_handler
raise e.with_traceback(filtered_tb) from None
File "C:\Users\tueku\Envs\facenet5\lib\site-packages\keras\utils\generic_utils.py", line 793, in func_load
code = marshal.loads(raw_code)
ValueError: bad marshal data (unknown type code)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
当您将模型保存在一个Python版本(例如3.6)中时,通常会发生这种情况,然后尝试将该模型加载到另一个Python版本中(例如,3.9),因为Keras使用的二进制序列化(元帅)不兼容/向下兼容。尝试使用适当版本的TensorFlow / keras库安装旧版本的Python。如果该模型不是自己训练的,则可以要求创作者以不同的格式导出训练有素的模型,例如 onnx 。
This typically happens when you save a model in one Python version (e.g., 3.6) and then try to load that model in another Python version (e.g., 3.9), as the binary serialization that Keras uses (marshal) is not upwards/downwards compatible. Try to install an old version of Python with an appropriate version of the Tensorflow / Keras libraries. If the model was not trained by yourself, you may ask the creators to export the trained models in a different format that doesn't have these problems, like ONNX.