【发布时间】:2018-01-06 21:13:59
【问题描述】:
我制作了一段在 Windows 上运行的 Python 深度学习代码原型,但我无法让它在 Linux 上运行。我发现问题来自 load_model。 这是一段 Python 代码,它在 Windows 和 Linux 上的行为不同。
两个 Keras 安装均来自 Keras 团队的 github 源代码库,因为标准 Keras 包无法识别模型格式,最近为 Github 源代码中的字符格式做了一个补丁。
你知道发生了什么吗?
代码:
from keras.models import load_model, Model
import sys
import keras
import tensorflow as tf
import os
import platform
print("----------------------------------------------")
print("Operating system:")
print (os.name)
print(platform.system())
print(platform.release())
print("----------------------------------------------")
print("Python version:")
print(sys.version)
print("----------------------------------------------")
print("Tensorflow version: ", tf.__version__)
print("----------------------------------------------")
print("Keras version : ", keras.__version__)
print("----------------------------------------------")
yolo_model = load_model("model.h5")
Windows 输出:
Using TensorFlow backend.
----------------------------------------------
Operating system:
nt
Windows
7
----------------------------------------------
Python version:
3.6.0 (v3.6.0:41df79263a11, Dec 23 2016, 08:06:12) [MSC v.1900 64 bit (AMD64)]
----------------------------------------------
Tensorflow version: 1.4.0
----------------------------------------------
Keras version : 2.1.2
----------------------------------------------
2018-01-06 21:54:37.700794: I C:\tf_jenkins\home\workspace\rel-win\M\windows\PY\36\tensorflow\core\platform\cpu_feature_guard.cc:137] Your CPU supports instruc
ions that this TensorFlow binary was not compiled to use: AVX AVX2
C:\Users\David\AppData\Local\Programs\Python\Python36\lib\site-packages\keras-2.1.2-py3.6.egg\keras\models.py:252: UserWarning: No training configuration found
in save file: the model was *not* compiled. Compile it manually.
Linux 输出:
Using TensorFlow backend.
----------------------------------------------
Operating system:
posix
Linux
4.9.0-5-amd64
----------------------------------------------
Python version:
3.5.3 (default, Jan 19 2017, 14:11:04)
[GCC 6.3.0 20170118]
----------------------------------------------
Tensorflow version: 1.4.1
----------------------------------------------
Keras version : 2.1.2
----------------------------------------------
----------------------------------------------
2018-01-06 21:47:58.099715: I tensorflow/core/platform/cpu_feature_guard.cc:137] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX
Erreur de segmentation
法语Erreur de segmentation的意思是Segmentation fault
感谢您的帮助!
玻璃蛙
【问题讨论】:
-
如果你能为此在 github 上提交一个 bug,那就太好了。它需要包含一些重现问题的方法或至少一些非常详细的日志,因为没有这些信息很难调试。
-
我可以提交一个错误并提供模型文件,但它大约有 200 Mb。如果有方便的方式在某处发布它,请告诉我。
-
我不知道这个有什么习惯的地方。
标签: linux python-3.x tensorflow segmentation-fault keras