python - FailedPreconditionError: Error while reading resource variable module..在评估张量流预训练模型时
问题描述
我已经通过 inception3 训练了一个二值图像分类器。我能够在创建模型后立即对其进行评估。但是,如果我保存模型并重新加载它,然后尝试评估或预测,那么我会收到以下错误:
FailedPreconditionError: Error while reading resource variable module_16/InceptionV3/Mixed_6d/Branch_2/Conv2d_0c_1x7/BatchNorm/beta from Container: localhost. This could mean that the variable was uninitialized. Not found: Resource localhost/module_16/InceptionV3/Mixed_6d/Branch_2/Conv2d_0c_1x7/BatchNorm/beta/N10tensorflow3VarE does not exist.
[[{{node lambda_2_8/module_16_apply_default/InceptionV3/InceptionV3/Mixed_6d/Branch_2/Conv2d_0c_1x7/BatchNorm/ReadVariableOp}}]]
这是代码片段:
with tf.compat.v1.Session() as sess:
sess.run(tf.global_variables_initializer())
#sess.run(tf.local_variables_initializer())
new_model = tf.keras.models.load_model('mymodel.h5')
new_model.summary()
eval_model=new_model.evaluate(image_test, label_test)
eval_model
配置:tensorflow 1.14.0-rc1,Keras
2.2.4-tf
解决方案
推荐阅读
- javascript - 将组添加到超过 82 条记录的交叉过滤器内存不足
- python - Matplotlib 找不到草书字体
- html - 标题对齐中心而不考虑css中的设备宽度
- excel - Excel随机数生成器不产生重复?
- google-drive-api - 错误:restricted_client 使用 google drive api
- php - 在 PHP 中控制另一个用户的会话
- python - 所有正整数元组
- ruby-on-rails - 通过 ActiveJob 发送设计邮件
- android - 日历在添加一天时给出错误的时间戳
- html - HTML 表语义结构 - 行上的替代数据