Skip to content

OpenCV cannot import ONNX model: step >= 1 in function 'cv::dnn::SliceLayerImpl::SliceLayerImpl' #22794

@ukoehler

Description

@ukoehler

System Information

OpenCV => Python opencv-python-rolling 4.6.0.20221022
Operating System / Platform Windows 10 64 bit
Python =>3.10.4

Detailed description

I converted the DecoupledSeg from PaddleSeg to ONNX:

https://github.com/PaddlePaddle/PaddleSeg/tree/release/2.6/configs/decoupled_segnet

This fails to load in OpenCV 4.6 pre-release:

[ERROR:0@0.552] global D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp (1050) cv::dnn::dnn4_v20220524::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 5 inputs and 1 outputs: [Slice]:(onnx_node!p2o.Slice.4) from domain='ai.onnx'
Traceback (most recent call last):
  File "d:\Local\devel\Python\OpenCV\dnn_segmentation_paddle_decoupledseg_cityscapes\inference.py", line 121, in <module>
    model = cv2.dnn.readNet(model_path)
cv2.error: OpenCV(4.6.0-dev) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1069: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20220524::ONNXImporter::handleNode'
> Node [Slice@ai.onnx]:(onnx_node!p2o.Slice.4) parse error: OpenCV(4.6.0-dev) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\slice_layer.cpp:182: error: (-215:Assertion failed) step >= 1 in function 'cv::dnn::SliceLayerImpl::SliceLayerImpl'

Steps to reproduce

model = cv2.dnn.readNet(model_path)

Find the ONNX file here:
https://drive.google.com/file/d/1qIVxTS2lZpN4fapN3yvnYrZ3x0g4rD4w/view?usp=sharing

Issue submission checklist

  • I report the issue, it's not a question
  • I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
  • I updated to the latest OpenCV version and the issue is still there
  • There is reproducer code and related data files (videos, images, onnx, etc)

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions