onnx / onnx/models

SSD-MobilenetV1 fails with the latest onnx.shape_inference due to If in subgraph

Open
#628 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Jupyter Notebook
Stars
9.8k
Forks
1.6k
PR merge metrics
No merged PRs in 30d

Description

Bug Report

Which model does this pertain to?

SSD-MobilenetV1: https://github.com/onnx/models/blob/main/vision/object_detection_segmentation/ssd-mobilenetv1/model/ssd_mobilenet_v1_10.onnx

Describe the bug

Failed with the latest onnx as:

2023-08-28T00:24:37.5488680Z Downloading SSD-MobilenetV1 to local path /Users/runner/.cache/onnx/hub/vision/object_detection_segmentation/ssd-mobilenetv1/model/1fbcf47654165f2e0b5f1bdf3f123b9e9e1128cd6463717767b76ab4b5246f9a_ssd_mobilenet_v1_10.onnx
2023-08-28T00:24:37.5489340Z [PASS]: SSD-MobilenetV1 is checked by onnx checker with shape_inference. 
2023-08-28T00:24:37.5490300Z [FAIL]: [ShapeInferenceError] Inference error(s): (op_type:Loop, node name: generic_loop_Loop__48): [ShapeInferenceError] Inference error(s): (op_type:If, node name: Postprocessor/BatchMultiClassNonMaxSuppression/map/while/PadOrClipBoxList/cond_If__115): [ShapeInferenceError] Inference error(s): (op_type:Concat, node name: Postprocessor/BatchMultiClassNonMaxSuppression/map/while/PadOrClipBoxList/cond/concat): [ShapeInferenceError] All inputs to Concat must have same rank. Input 1 has rank 1 != 2

after the enhancement from ONNX: https://github.com/onnx/onnx/pull/5488.

Reproduction instructions

System Information

OS Platform and Distribution (e.g. Linux Ubuntu 16.04): ubuntu-22.04
ONNX version (e.g. 1.6): latest (upcoming 1.5.0)
Backend/Runtime version (e.g. ONNX Runtime 1.1, PyTorch 1.2): N/A

Provide a code snippet to reproduce your errors.

import onnx
model = onnx.load('model.onnx')
inferred = onnx.shape_inference.infer_shapes(model, strict_mode=True)
...
Notes

Since ONNX Model Zoo will deprecate these ancient models https://github.com/onnx/models/issues/616, we can also consider just remove this if the direct fix is difficult, because we have a correct newer model already (opset_version 12 instead of 10): ssd_mobilenet_v1_12.onnx.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with vision/object_detection_segmentation/ssd-mobilenetv1/model/ssd_mobilenet_v1_10.onnx and reproduce the failure using onnx.shape_inference.infer_shapes with strict_mode=True. Compare it with ssd_mobilenet_v1_12.onnx and review ONNX PR 5488 plus issue 616. Done means the older model no longer fails validation, or the deprecated model is removed as agreed.

Written by the indexing model from the issue text.

Assessment

Domain
computer-vision, machine-learning, testing-qa
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.