简体   繁体   English

将模型转换为 android 的 pb 文件时出错

[英]Getting error while converting model into pb file for android

I am getting this error:我收到此错误:

frozen_graph = freeze_graph(K.get_session(), output_names=[model.output.op.name])

TypeError: 'module' object is not callable

I am using tensorflow version 1.15.0 with keras 2.0.5我正在使用 tensorflow 1.15.0 版和 keras 2.0.5

You did not include the full code but let me guess, your have an import statement that looks like this:您没有包含完整的代码,但让我猜猜,您有一个如下所示的导入语句:

from tensorflow.tools import freeze_graph

It should be:它应该是:

from tensorflow.tools.freeze_graph import freeze_graph

This is because the freeze_graph function actually lives in a module that is called freeze_graph as well.这是因为freeze_graph函数实际上也存在于一个名为freeze_graph的模块中。 The import statement you used import the whole module.您使用的导入语句导入整个模块。 When your code reaches the freeze_graph part is, quite accurately, errors out saying modules are not callable :)当您的代码到达freeze_graph部分时,非常准确,错误提示模块不可调用:)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM