onnx / models

A collection of pre-trained, state-of-the-art models in the ONNX format

Home Page:http://onnx.ai/models/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

jcwchen opened this issue · comments

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: onnx/onnx#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 #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.