在将模型转换为android的PB文件时出现错误 [英] Getting error while converting model into pb file for android

查看:91
本文介绍了在将模型转换为android的PB文件时出现错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我收到此错误:

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

TypeError: 'module' object is not callable

我正在将tensorflow版本1.15.0与keras 2.0.5一起使用

I am using tensorflow version 1.15.0 with keras 2.0.5

推荐答案

您没有提供完整的代码,但让我猜想,您有一个类似于以下内容的import语句:

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

应该是:

from tensorflow.tools.freeze_graph import freeze_graph

这是因为freeze_graph函数实际上也存在于称为freeze_graph的模块中.您使用的import语句将导入整个模块.当您的代码到达freeze_graph部分时,很准确地讲出错误,指出模块不可调用:)

This is because the freeze_graph function actually lives in a module that is called freeze_graph as well. 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 :)

这篇关于在将模型转换为android的PB文件时出现错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆