-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
ONNXImporter ERROR while import YOLO 4 with asymetric padding (TensorFlow 2.x & Keras) #19316
Copy link
Copy link
Closed
Description
System information (version)
- OpenCV => 4.5.1.48
- Operating System / Platform => Windows 64 bit / Python
Detailed description
I have created a YoloV4 Keras Model using TensorFlow-2.x-YOLOv4, that I am converting to ONNX using keras2onnx, which works fine. For this I am using the following code:
from keras.backend import common as K
model = Load_Yolo_model() # TensorFlow-2.x-YOLOv4 specific code
K.set_image_data_format('channels_first') # change format for OpenCV
onnx_model = keras2onnx.convert_keras(model, model.name)
keras2onnx.save_model(onnx_model, "model.onnx")When I am loading the model using OpenCV's net = cv2.dnn.readNetFromONNX('model.onnx') I am getting the following Exception:
cv::dnn::dnn4_v20201117::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 3 inputs and 1 outputs: [Conv]:(convolution_output19)
Steps to reproduce
I have attached the onnx.model here:
model.zip
If you open it using the following code the mentioned exception is raised:
from cv2 import cv2
net = cv2.dnn.readNetFromONNX('model.onnx')Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution - I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc
Reactions are currently unavailable