将张量流模型转换为英特尔Movidius图的问题

问题描述 投票:0回答:1

您好我在尝试使用具有张量流的英特尔Movidius神经棒时遇到了问题。我有keras模型,我将其转换为tensorflow模型。当我将其转换为Movidius图时,我收到错误:

Traceback (most recent call last):
File "/usr/local/bin/mvNCCompile", line 118, in
create_graph(args.network, args.inputnode, args.outputnode, args.outfile, args.nshaves, args.inputsize, args.weights)
File "/usr/local/bin/mvNCCompile", line 104, in create_graph
net = parse_tensor(args, myriad_config)
File "/usr/local/bin/ncsdk/Controllers/TensorFlowParser.py", line 290, in parse_tensor
if have_first_input(strip_tensor_id(node.outputs[0].name)):
IndexError: list index out of range

这是我的代码:

from keras.models import model_from_json
from keras.models import load_model
from keras import backend as K
import tensorflow as tf
import nn
import os

weights_file = "weights.h5"

sess = K.get_session()
K.set_learning_phase(0)
model = nn.alexnet_model() # get keras model
model.load_weights(weights_file)

saver = tf.train.Saver()
saver.save(sess, "./TF_Model/tf_model") # convert keras to tensorflow model

tf_model_path = "./TF_Model/tf_model"

fw = tf.summary.FileWriter('logs', sess.graph)
fw.close()

os.system('mvNCCompile TF_Model/tf_model.meta -in=conv2d_1_input -on=activation_7/Softmax') # get Movidius graph

Python版本:2.7 OS:Ubuntu 16.04 Tensorflow版本:1.12

python tensorflow machine-learning
1个回答
0
投票

据我所知,ncsdk编译器无法解析普通tensorflow网络的每个部分,因此您必须修改网络并以NCS友好的方式重新保存,以便成功制作Movidius图。

有关如何修改tensorflow网络的更多信息,请查看the official guidance

希望它会对你有所帮助。

© www.soinside.com 2019 - 2024. All rights reserved.