Skip to content

Updated model for ORT support#1359

Open
varun-jaiswal17 wants to merge 2 commits into
opencv:5.xfrom
varun-jaiswal17:fix/shape-inference-onnx
Open

Updated model for ORT support#1359
varun-jaiswal17 wants to merge 2 commits into
opencv:5.xfrom
varun-jaiswal17:fix/shape-inference-onnx

Conversation

@varun-jaiswal17
Copy link
Copy Markdown
Contributor

Summary

This PR patches 18 ONNX test models under testdata/dnn/onnx/models/ to be
compatible with the ONNX Runtime (ORT) engine (OPENCV_FORCE_DNN_ENGINE=4).
The models were regenerated or attribute-patched to remove deprecated/invalid
ONNX attributes that ORT enforces strictly.

Companion PR: opencv/opencv#28872


Binary model changes

Model file Change
average_pooling.onnx Removed deprecated kernel_shape / strides attribute encoding; re-exported at opset 7
batch_norm.onnx Removed legacy spatial, is_test, consumed_inputs attributes (opset 1 → 7)
constant.onnx Cleaned up unused legacy attributes; re-exported at opset 7
dropout.onnx Removed is_test, consumed_inputs attributes (opset 1 → 7)
linear.onnx Removed legacy broadcast attribute from Add node (opset 1 → 7)
mul.onnx Removed legacy broadcast, axis attributes from Mul node (opset 1 → 7)
multy_inputs.onnx Re-exported to remove deprecated node attributes
equal_same_dims.onnx Re-exported to clean up opset metadata
reduce_mean_axis1.onnx Replaced deprecated axes attribute with axes input (opset 11 → 11, attribute-style fixed)
reduce_mean_axis2.onnx Replaced deprecated axes attribute with axes input (opset 11 → 11, attribute-style fixed)
reduce_sum.onnx Moved axes to input tensor per opset 13 semantics
dynamic_resize_10.onnx Added explicit sizes / scales input to satisfy ORT shape requirements
dynamic_resize_9.onnx Added required inputs for Resize opset 9
dynamic_resize_scale_10.onnx Added explicit scales input
dynamic_resize_scale_9.onnx Added explicit scales input
resize_bilinear.onnx Added required roi and scales inputs (opset 11)
resize_nearest.onnx Added required scales input (opset 9)
resize_nearest_unfused_opset11_torch1.3.onnx Simplified model; removed extraneous subgraph nodes that ORT rejected

Testing

All 18 affected tests pass with OPENCV_FORCE_DNN_ENGINE=4 , OPENCV_FORCE_DNN_ENGINE=2 , OPENCV_FORCE_DNN_ENGINE=1:

AveragePooling, BatchNormalization, Dropout, Linear, Multiplication,
CompareSameDims_EQ, ReduceMean, ReduceSum, Quantized_MatMul (via constant.onnx),
dynamic_resize_, resize_bilinear, resize_nearest, resize_nearest_unfused_

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant