Skip to content

dnn module: problem when importing ONNX model #22355

@rejuce

Description

@rejuce
System information (version)
Detailed description

I am trying to import an ONNX model exportet from standard keras applications (NASNet)
but the import always fails with exceptions.

[ERROR:0@2.754] global C:\QtProjects\LIB\opencv-4.6.0\modules\dnn\src\onnx\onnx_importer.cpp (1021) cv::dnn::dnn4_v20220524::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 4 inputs and 1 outputs: [Slice]:(onnx_node!model_41/NASNet/cropping2d_29/strided_slice) from domain='ai.onnx'
exception caught: OpenCV(4.6.0) C:\QtProjects\LIB\opencv-4.6.0\modules\dnn\src\onnx\onnx_importer.cpp:1040: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20220524::ONNXImporter::handleNode'

Node [Slice@ai.onnx]:(onnx_node!model_41/NASNet/cropping2d_29/strided_slice) parse error: OpenCV(4.6.0) C:\QtProjects\LIB\opencv-4.6.0\modules\dnn\src\onnx\onnx_importer.cpp:1345: error: (-215:Assertion failed) axes[i - 1] == axes[i] - 1 in function 'cv::dnn::dnn4_v20220524::ONNXImporter::parseSlice'

changeing opset to a lower number fixed a previous import error but for this problem there was no helping it....I tried using opset 1-16, with down to 9 yieling same error, below a similar
axes.get(i - 1) == axes.get(i) - 1

Steps to reproduce

export default keras application NASNet to ONNX, try to import in cv:dnn: readNetFromONNX

Issue submission checklist
  • [x ] I report the issue, it's not a question

  • [x ] I checked the problem with documentation, FAQ, open issues,
    forum.opencv.org, Stack Overflow, etc and have not found any solution

  • [x ] I updated to the latest OpenCV version and the issue is still there

    • Provide ONNX file for some public model or ONNX file with random weights,
      if you report ONNX parsing or handling issue. Architecture details diagram
      from netron tool can be very useful too. See https://lutzroeder.github.io/netron/
      -->

the model has more than 750 layers, i suspect this strided_slice node is the culprit...

grafik
stripe14.onnx.txt

Metadata

Metadata

Assignees

Labels

bugcategory: dnn (onnx)ONNX suport issues in DNN moduleconfirmedThere is stable reproducer / investigation complete

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions