首页 > 解决方案 > 无法将 pb 模型加载到 keras 模型中

问题描述

我有一个预训练的 pb 模型,我正在尝试将其加载为 keras 模型,以便我可以运行类似 model.summary() 但加载 pb 模型后的类型是“AutoTrackable”对象,没有属性“summary” '。这是我正在使用的代码

model = tf.saved_model.load('my_model/') # folder that contains the pb model
model.summary()

这是错误消息:

"AttributeError: 'AutoTrackable' object has no attribute 'summary'"

有人可以帮忙吗?

标签: tensorflowkeras

解决方案


推荐阅读