Article ID: 000088394 Content Type: Error Messages Last Reviewed: 05/20/2022

Received Node-Related Errors When Converting YOLOv5 ONNX Model into Intermediate Representation (IR) Format

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

Correct Model Optimizer command to convert YOLOv5 ONNX model into IR format.

Description
  • Converted YOLOv5 ONNX model into IR format:

    python /opt/intel/openvino_2021/deployment_tools/model_optimizer/mo.py --input_model "model.onnx" --output_dir  "cur_folder/"

  • Received error:

    [ ERROR ] The ExpandDims node Unsqueeze_583 has more than 1 input
    [ ERROR ] Cannot infer shapes or values for node "Slice_4".
    [ ERROR ] Output shape: [0 3 0 0] of node "Slice_4" contains non-positive values
    [ ERROR ] It can happen due to bug in custom shape infer function <function Slice.infer at 0x7fda43996f70>.
    [ ERROR ] Or because the node inputs have incorrect values/shapes.
    [ ERROR ] Or because input shapes are incorrect (embedded to the model or passed via --input_shape).

Resolution

There are three output nodes in YOLOv5 and all of them need to be specified in the command:

Model Optimizer command: python mo.py --input_model model.onnx --output <output nodes> --input_shape [1,3,512,512]

Additional information

Use Netron to visualize the YOLOv5 ONNX weight.

Related Products

This article applies to 2 products