无法加载模型keras [Django]

时间:2017-12-28 22:06:45

标签: python django tensorflow keras

我正在开发一个用户上传图像的Web应用程序,然后我使用保存在硬盘中的模型进行预测。我不确定导致错误的原因。它与图像有关吗?

我收到以下错误:

ValueError: Fetch argument <tf.Operation 'init' type=NoOp> cannot be 
interpreted as a Tensor. (Operation name: "init"
op: "NoOp"
input: "^dense_1/kernel/Assign"
input: "^dense_1/bias/Assign"
input: "^dense_2/kernel/Assign"
input: "^dense_2/bias/Assign"
input: "^dense_3/kernel/Assign"
input: "^dense_3/bias/Assign"
  is not an element of this graph.)

我的Keras配置文件是:

{
      "epsilon": 1e-07,
      "floatx": "float32",
      "image_data_format": "channels_last",
      "backend": "tensorflow"
}

我加载模型的python代码是:

model = load_model('my_model.h5')
model.load_weights('my_model_weights.h5')

0 个答案:

没有答案