Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6403 Discussions

Yolov7 model conversion to IR format failed

abhi_jci
Beginner
739 Views

Yolov7 (https://github.com/WongKinYiu/yolov7)  model originally trained in pytorch conversion failed when tried to convert in IR format

First converted torch model (yolov7-e6.pt) to ONNX format, then tried to convert ONNX model to OpenVINO format.

To convert the model i used this command from Yolov6

python deploy/OpenVINO/export_openvino.py --weights ./pretrained/yolov7-e6.pt --img 1280 --batch 1

https://github.com/meituan/YOLOv6/blob/main/deploy/OpenVINO/export_openvino.py


Here is the error i received:

Starting to export OpenVINO...
[ ERROR ] -------------------------------------------------
[ ERROR ] ----------------- INTERNAL ERROR ----------------
[ ERROR ] Unexpected exception happened.
[ ERROR ] Please contact Model Optimizer developers and forward the following information:
[ ERROR ] While validating ONNX node '<Node(Mul): Mul_656>':
Check 'PartialShape::broadcast_merge_into(pshape, node->get_input_partial_shape(i), autob)' failed at core/src/op/util/elementwise_args.cpp:30:
While validating node 'v1::Multiply Multiply_8141 (1666[0]:f32{1,3,160,160,2}, 3028[0]:f32{3,2}) -> (dynamic...)' with friendly_name 'Multiply_8141':
Argument shapes are inconsistent.

[ ERROR ] Traceback (most recent call last):
File "/Users/abhishekmitra/Documents/Abhishek/Projects_2022/v2/YOLOv6-main/env_yolov6/lib/python3.7/site-packages/openvino/tools/mo/main.py", line 533, in main
ret_code = driver(argv)
File "/Users/abhishekmitra/Documents/Abhishek/Projects_2022/v2/YOLOv6-main/env_yolov6/lib/python3.7/site-packages/openvino/tools/mo/main.py", line 489, in driver
graph, ngraph_function = prepare_ir(argv)
File "/Users/abhishekmitra/Documents/Abhishek/Projects_2022/v2/YOLOv6-main/env_yolov6/lib/python3.7/site-packages/openvino/tools/mo/main.py", line 394, in prepare_ir
ngraph_function = moc_pipeline(argv, moc_front_end)
File "/Users/abhishekmitra/Documents/Abhishek/Projects_2022/v2/YOLOv6-main/env_yolov6/lib/python3.7/site-packages/openvino/tools/mo/moc_frontend/pipeline.py", line 147, in moc_pipeline
ngraph_function = moc_front_end.convert(input_model)
RuntimeError: While validating ONNX node '<Node(Mul): Mul_656>':
Check 'PartialShape::broadcast_merge_into(pshape, node->get_input_partial_shape(i), autob)' failed at core/src/op/util/elementwise_args.cpp:30:
While validating node 'v1::Multiply Multiply_8141 (1666[0]:f32{1,3,160,160,2}, 3028[0]:f32{3,2}) -> (dynamic...)' with friendly_name 'Multiply_8141':
Argument shapes are inconsistent.


[ ERROR ] ---------------- END OF BUG REPORT --------------
[ ERROR ] -------------------------------------------------

Please help to overcome above error.

 

Thanks in advance.

0 Kudos
2 Replies
IntelSupport
Moderator
716 Views

Hi abhi_jci,

 

Thanks for reaching out.


The Mul_656 Operation is not supported in OpenVINO. To use the yolov7 model, I would advise you either remove the operation or change the Mul_656 operation to another operation that is supported based on ONNX* Supported Operators.

 

 

Regards,

Aznie


0 Kudos
IntelSupport
Moderator
689 Views

Hi abhi_jci,


This thread will no longer be monitored since we have provided a solution. If you need any additional information from Intel, please submit a new question.



Regards,

Aznie


0 Kudos
Reply