intel movidius 神经元计算棒 mvNCCompile 模型转换工具
摘要
mvNCCompile是一个命令行工具,可将Caffe或TensorFlow模型的网络和权重文件编译为Movidius Graph文件格式
参考链接:
https://movidius.github.io/ncsdk/tools/compile.html
caffe文件转换命令
mvNCCompile network.prototxt [-w network.caffemodel] [-s max_number_of_shaves] [-in input_node_name] [-on output_node_name] [-is input_width input_height] [-o output_graph_filename] [-ec]
TensorFlow文件转换命令
mvNCCompile network.meta [-s max_number_of_shaves] [-in input_node_name] [-on output_node_name] [-is input_width input_height] [-o output_graph_filename] [-ec]
参数描述
参数 | 描述 |
---|---|
[-h,-help] | 显示命令的帮助 |
network.prototxt | caffe网络文件的名称 |
network.meta network.pb | TensorFlow网络文件的名称 |
[-w network.caffemodel] | 权重文件名。对于Caffe,这是.caffemodel文件。如果省略将使用零权重。此选项不适用于TensorFlow网络 |
[-s max_number_of_shaves] | 指定用于网络层的最大SHAVE数(默认值:1) |
[-in input_node_name] | 为网络指定备用起点。默认情况下,网络的起点是输入层。此选项启用部分网络处理。当与-on选项一起使用时,用户可以隔离网络中的一个或多个层以进行分析。 |
[-on output_node_name] | 为网络指定终点。默认情况下,网络的终点是输出层。此选项启用部分网络处理。当与-in选项一起使用时,用户可以隔离网络中的一个或多个层以进行分析。 |
[-is input_width input_height] | 为输入图层上没有尺寸限制的网络指定输入尺寸 |
[-o output_graph_filename] | 指定输出图形文件名。如果未提供,则“graph”将用于文件名。 |
[-ec] | 跳过某些编译器优化以进行连接; 这可能会纠正来自concat层或编译失败的无效结果的一些问题。 |
注1:[-in input_node_name]选项中,TensorFlow网络在创建网络时使用name参数(适用于大多数图层),并将该名称传递给此选项。
要添加不更改网络的命名节点,可以使用以下命令:
x = tensorflow.identity(prev_tensor, name='new_node')
注2:解析器将在[-on output_node_name]节点名称的第一个实例处停止(例如,如果Conv之后的Relu将共享同一名称,则不会处理它)。
caffe 例子
mvNCCompile deploy.prototxt -w bvlc_googlenet.caffemodel -s 12 -in input -on prob -is 224 224 -o GoogLeNet.graph
TensorFlow例子
mvNCCompile inception-v1.meta -s 12 -in=input -on=InceptionV1/Logits/Predictions/Reshape_1 -is 224 224 -o InceptionV1.graph