简体   繁体   English

从 ONNX 转换后 OpenVINO 输出密钥错误

[英]OpenVINO output key error after conversion from ONNX

I've converted a (modified) Darknet model to onnx, (tried opset 10 & 11) and then converting this onnx model into IR using this (at the bottom)我已经将一个(修改过的)Darknet 模型转换为 onnx,(尝试了 opset 10 和 11),然后使用这个(在底部)将这个 onnx 模型转换为 IR

Everything seems to be OK一切似乎都OK

C:\Program Files (x86)\IntelSWTools\openvino_2020.3.194\deployment_tools\model_optimizer>python mo.py --input_model C:\dev\yolo\weights\export.onnx --progress --output_dir C:\dev\yolo\weights\
Model Optimizer arguments:
Common parameters:
        - Path to the Input Model:      C:\dev\yolo\weights\export.onnx
        - Path for generated IR:        C:\dev\yolo\weights\
        - IR output name:       export
        - Log level:    ERROR
        - Batch:        Not specified, inherited from the model
        - Input layers:         Not specified, inherited from the model
        - Output layers:        Not specified, inherited from the model
        - Input shapes:         Not specified, inherited from the model
        - Mean values:  Not specified
        - Scale values:         Not specified
        - Scale factor:         Not specified
        - Precision of IR:      FP32
        - Enable fusing:        True
        - Enable grouped convolutions fusing:   True
        - Move mean values to preprocess section:       False
        - Reverse input channels:       False
ONNX specific parameters:
Model Optimizer version:
Progress: [....................] 100.00% done
[ SUCCESS ] Generated IR version 10 model.
[ SUCCESS ] XML file: C:\dev\yolo\weights\export.xml
[ SUCCESS ] BIN file: C:\dev\yolo\weights\export.bin
[ SUCCESS ] Total execution time: 10.24 seconds.

When I try to load this model using the provided YOLO sample from here , loading is fine, but when I inspect the net object in debug mode I see that the outputs are Transpose_231 , Transpose_237 and Slice_230/Split.1 .当我尝试使用此处提供的 YOLO 示例加载此模型时,加载很好,但是当我在调试模式下检查网络对象时,我看到输出为Transpose_231Transpose_237Slice_230/Split.1 When I inspect the layers, I see it contains Transpose_231 , Transpose_237 and Slice_230/Split (note, missing .1 in the split)当我检查图层时,我看到它包含Transpose_231Transpose_237Slice_230/Split (注意, Slice_230/Split缺少.1

This causes the sample to fail with KeyError: 'Slice_230/Split.1' in这会导致样本失败,出现KeyError: 'Slice_230/Split.1' in

    for layer_name, out_blob in output.items():
        out_blob = out_blob.buffer.reshape(net.layers[net.layers[layer_name].parents[0]].out_data[0].shape)

If I inspect the IR's .XML file I don't see any .1 in it如果我检查 IR 的 .XML 文件,我在其中看不到任何.1

        <layer id="214" name="Slice_230/Split" type="VariadicSplit" version="opset1">
            <input>
                <port id="0">
                    <dim>6</dim>
                    <dim>142191</dim>
                </port>
                <port id="1"/>
                <port id="2">
                    <dim>3</dim>
                </port>
            </input>
            <output>
                <port id="3" precision="FP32">
                    <dim>4</dim>
                    <dim>142191</dim>
                </port>
                <port id="4" precision="FP32">
                    <dim>1</dim>
                    <dim>142191</dim>
                </port>
                <port id="5" precision="FP32">
                    <dim>1</dim>
                    <dim>142191</dim>
                </port>
            </output>
        </layer>

Any suggestions where this .1 comes from?这个.1来自哪里有什么建议吗?

EDIT编辑

Tried using opset 9, the same thing happens only this time with Slice_174/Split & Slice_174/Split.1尝试使用 opset 9,仅这次使用Slice_174/Split & Slice_174/Split.1 Slice_174/Split会发生同样的事情

The split-1 is actually a Category of Data movement operations. split-1 实际上是一种数据移动操作的类别。 It Split operation splits an input tensor into pieces of the same length along some axis.它拆分操作将输入张量沿某个轴拆分为相同长度的部分。

This Split operation splits the "data" input tensor into pieces of the same length along "axis" .此拆分操作将“数据”输入张量沿“轴”拆分为相同长度的片段。 The i-th shape of output tensor will be equal to the "data" shape except along dimension "axis" where the shape will be data.shape[i]/num_splits.输出张量的第 i 个形状将等于“数据”形状,除了沿维度“轴”的形状将是 data.shape[i]/num_splits。 The sum of elements of split_lengths must match data.shape[axis]. split_lengths 的元素总和必须匹配 data.shape[axis]。

One of the example:例子之一:

<layer id="1" type="Split" ...>
    <data num_splits="3" />
    <input>
        <port id="0">       <!-- some data -->
            <dim>6</dim>
            <dim>12</dim>
            <dim>10</dim>
            <dim>24</dim>
        </port>
        <port id="1">       <!-- axis: 1 -->
        </port>
    </input>
    <output>
        <port id="2">
            <dim>6</dim>
            <dim>4</dim>
            <dim>10</dim>
            <dim>24</dim>
        </port>
        <port id="3">
            <dim>6</dim>
            <dim>4</dim>
            <dim>10</dim>
            <dim>24</dim>
        </port>
        <port id="4">
            <dim>6</dim>
            <dim>4</dim>
            <dim>10</dim>
            <dim>24</dim>
        </port>
    </output>
</layer>

You may refer here for further info: https://docs.openvinotoolkit.org/latest/openvino_docs_ops_movement_Split_1.html您可以参考此处了解更多信息: https : //docs.openvinotoolkit.org/latest/openvino_docs_ops_movement_Split_1.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM