Article ID: 000088813 Content Type: Troubleshooting Last Reviewed: 05/20/2022

Unable to Convert ONNX Faster R-CNN Model to Intermediate Representation (IR)

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

Model Optimizer command that changes the input shape to NCHW to convert an ONNX Faster R-CNN model to IR.

Description
  • Convert fasterRCNN-10.onnx model into IR using command:

    python ./mo_onnx.py --input_model FasterRCNN-10.onnx --input_shape [3,960,960] --mean_values [102.9801,115.9465,122.7717] --transformations_config ./extensions/front/onnx/faster_rcnn.json

  • Output:

    [ ERROR ]  Exception occurred during running replacer "REPLACEMENT_ID" (<class 'extensions.middle.AddMeanScaleValues.AddMeanScaleValues'>): Numbers of inputs and mean/scale values do not match.

Resolution
  • FasterRCNN-10.onnx model has CHW input shape.
  • Add the --input "0:2" parameter to the Model Optimizer command to change input shape to NCHW:

    python ./mo_onnx.py --input_model FasterRCNN-10.onnx --input_shape [3,800,800] --mean_values [102.9801,115.9465,122.7717] --transformations_config ./extensions/front/onnx/faster_rcnn.json --input "0:2"

Related Products

This article applies to 2 products