如何更改现有张量流模型(.pb)的输入形状

时间:2019-05-30 10:28:52

标签: tensorflow ncsdk movidius

我想将先前存在的张量流图转换为可以在Movidius神经计算棒上部署的图。

当我使用命令mvNCCompile(来自NCSDK)时,出现以下错误: [错误5]工具包错误:不支持舞台详细信息:不支持动态输入形状。

检查张量板中的张量流图后,我发现输入张量具有以下形状:(?,?,?,3) 在我的用例中,我的输入形状始终是:(1,368,656,3)。

现在我想将张量的动态输入形状更改为静态形状。

我该怎么做?

我已经尝试过以下信息:How to change a saved model input shape in Tensorflow? 但我无法更改图表。

图形可在此处找到:https://github.com/ildoonet/tf-pose-estimation/blob/master/models/graph/mobilenet_thin/graph_opt.pb

import tensorflow as tf

graph_path = 
'/home/bk/Documents/OPSLim/Pose/graph_models/mobilenet_thin/graph_opt.pb'

with tf.gfile.GFile(graph_path, 'rb') as f:
    graph_def = tf.GraphDef()
    graph_def.ParseFromString(f.read())


graph = tf.get_default_graph()
tf_new_image = tf.placeholder(shape=(1, 368, 368, 3), dtype='float32', 
name='new_image')
tf.import_graph_def(graph_def, name='TfPoseEstimator', input_map= {"image:0": tf_new_image})

0 个答案:

没有答案