You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Model works perfectly when inferred with onnx and opencv==4.6.0
I get the following error with opencv==4.9.0-dev and opencv==5.x during model loading:
ERROR:0@1.272] global onnx_importer.cpp:1032 handleNode DNN/ONNX: ERROR during processing node with 6 inputs and 1 outputs: [Concat]:(onnx_node!Concat_146) from domain='ai.onnx'
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.9.0-dev) opencv/modules/dnn/src/onnx/onnx_importer.cpp:1054: error: (-2:Unspecified error) in function 'handleNode'
> Node [Concat@ai.onnx]:(onnx_node!Concat_146) parse error: OpenCV(4.9.0-dev) opencv/modules/dnn/src/layers/concat_layer.cpp:108: error: (-201:Incorrect size of input array) Inconsistent shape for ConcatLayer in function 'getMemoryShapes'
session=cv.dnn.readNetFromONNX(args.onnxmodel)
# Load and process the image using DexiNed modelorig_img=cv.imread(cv.samples.findFile(args.input))
# Prepocess the imageimg=preprocess(orig_img)
inp=cv.dnn.blobFromImage(img, swapRB=False, crop=False)
session.setInput(inp)
out=session.forward()
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)
The text was updated successfully, but these errors were encountered:
onnxsim model(1).onnx a.sim.onnx
opencv onnx importer does not process dynamic shape. You have to substitue w and h
python -m onnxruntime.tools.make_dynamic_shape_fixed --dim_param w --dim_value 640 a.sim.onnx a1.onnx
python -m onnxruntime.tools.make_dynamic_shape_fixed --dim_param h --dim_value 480 a1.onnx a2.onnx
then
python
Python 3.10.10 (tags/v3.10.10:aad5f6a, Feb 7 2023, 17:20:36) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2 as cv
>>> x = cv.dnn.readNet("a2.onnx")
>>> import numpy as np
>>> img = np.zeros((1, 3, 480,640))
>>> x.setInput(img)
>>> w = x.forward()
>>>
This bug should be fixed if possible. dexiened is used to replace hed_pretrained_bsds model for edge detection. Do we have other public onnx models without manual modification for edge detection? Use public model link will save our traffic.
System Information
Python 3.10.10
General configuration for OpenCV 4.6, 4.x and 5.x =====================================
Platform:
Host: Linux (Ubuntu 22.04) x86_64
CMake: 3.22.1
Configuration: Debug Release
Detailed description
Detailed description
Issue came up while adding a new onnx model dexiened for edge detection sample in dnn
onnx model can be downloaded from here
Model works perfectly when inferred with onnx and opencv==4.6.0
I get the following error with opencv==4.9.0-dev and opencv==5.x during model loading:
Similar issues: #24030 , #19416
Steps to reproduce
Here is the inference snippet:
Issue submission checklist
The text was updated successfully, but these errors were encountered: