小编Ham*_* MP的帖子

Tensorflow在C++中导出和运行图形的不同方法

要将训练有素的网络导入C++,您需要导出网络才能执行此操作.经过大量搜索并几乎找不到有关它的信息后,我们明白应该使用freeze_graph()来做到这一点.

感谢Tensorflow的新0.7版本,他们添加了它的文档.

在查看文档之后,我发现几乎没有类似的方法,你能说出freeze_graph()和之间有什么区别: tf.train.export_meta_graph因为它有类似的参数,但它似乎也可以用于将模型导入C++(我只是猜测区别是对于使用此方法输出的文件,您只能使用import_graph_def()或其他东西?)

还包括如何使用一个问题write_graph():在相关文件中体现graph_def由下式给出sess.graph_def,但例子freeze_graph()sess.graph.as_graph_def().这两者有什么区别?

这个问题与这个问题有关.

谢谢!

c++ python tensorflow

27
推荐指数
2
解决办法
2万
查看次数

TensorFlow random_shuffle_queue已关闭且元素不足

我通过获取想法阅读一批图像这里从tfrecords(通过转换)

我的图像是cifar图像,[32,32,3],你可以看到,在阅读和传递图像时,形状是正常的(batch_size=100)

据我所知,日志中陈述的两个最值得注意的问题是

  1. 形状12228,我不知道从哪里得到这个.我的所有张量都是形状[32,32,3]或[无,3072]
  2. 用完了样品

Compute status: Out of range: RandomSuffleQueue '_2_input/shuffle_batch/random_shuffle_queue' is closed and has insufficient elements (requested 100, current size 0)

我怎么解决这个问题?

日志:

1- image shape is  TensorShape([Dimension(3072)])
1.1- images batch shape is  TensorShape([Dimension(100), Dimension(3072)])
2- images shape is  TensorShape([Dimension(100), Dimension(3072)])

W tensorflow/core/kernels/queue_ops.cc:79] Invalid argument: Shape mismatch in tuple component 0. Expected [3072], got [12288]
W tensorflow/core/common_runtime/executor.cc:1027] 0x7fa72abc89a0 Compute status: Invalid argument: Shape mismatch in tuple component 0. Expected [3072], got [12288] …
Run Code Online (Sandbox Code Playgroud)

python tensorflow

21
推荐指数
3
解决办法
2万
查看次数

标签 统计

python ×2

tensorflow ×2

c++ ×1