LoSealL / openvino2onnx

Convert OpenVINO IR (XML) to ONNX format
MIT License
8 stars 0 forks source link

convert ERROR #19

Closed cucibala closed 1 week ago

cucibala commented 1 month ago

image

LoSealL commented 1 week ago

Please try v1.0 again

cucibala commented 1 week ago

image

cucibala commented 1 week ago

image

v1.0 Error

LoSealL commented 1 week ago

Can you try PR #23 ?

cucibala commented 1 week ago

Now it's OK, but I'm having trouble switching to another model

cucibala commented 1 week ago

1732076797488 image

LoSealL commented 1 week ago

can you share the xml or this model? (bin is not required), or you can share a small snippet around this operator: NormalizeL2_22659

cucibala commented 1 week ago

I sent an email to your mailbox

LoSealL commented 1 week ago

Thank you! I fix in #27 please have a try!

cucibala commented 1 week ago

When I load a model using OpenCV, I get the following error

OpenCV(4.5.4) F:\repos\opencv-4.5.4\modules\dnn\src\onnx\onnx_importer.cpp:739: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20211004::ONNXImporter::handleNode'

Node [Conv]:(Convolution_21635_output2) parse error: OpenCV(4.5.4) F:\repos\opencv-4.5.4\modules\dnn\src\layers\layers_common.cpp:106: error: (-5:Bad argument) kernel_size (or kernel_h and kernel_w) not specified in function 'cv::dnn::util::getKernelSize'

LoSealL commented 1 week ago

what about onnxruntime? can you check onnxruntime_test model.onnx 1

cucibala commented 1 week ago

Thank you! I fix in #27 please have a try!

image The conversion is successful, but using onnxruntime to load will give an error,

cucibala commented 1 week ago

what about onnxruntime? can you check onnxruntime_test model.onnx 1

image

LoSealL commented 1 week ago

For a quick validation on OnnxRuntime, can you modify your xml as follows?:

From

<layer id="707" name="Result_22666" type="Result" version="opset1">
            <input>
                <port id="0">
                    <dim>1</dim>
                    <dim>128</dim>
                </port>
            </input>
</layer>

To

<layer id="707" name="Result_22666" type="Result" version="opset1">
            <input>
                <port id="0" precision="FP32">
                    <dim>1</dim>
                    <dim>128</dim>
                </port>
            </input>
</layer>
LoSealL commented 1 week ago

When I load a model using OpenCV, I get the following error

OpenCV(4.5.4) F:\repos\opencv-4.5.4\modules\dnn\src\onnx\onnx_importer.cpp:739: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20211004::ONNXImporter::handleNode'

Node [Conv]:(Convolution_21635_output2) parse error: OpenCV(4.5.4) F:\repos\opencv-4.5.4\modules\dnn\src\layers\layers_common.cpp:106: error: (-5:Bad argument) kernel_size (or kernel_h and kernel_w) not specified in function 'cv::dnn::util::getKernelSize'

For OpenCV, it seems it needs kernel_shape attribute while it is not a mandatory attribute as onnx describes here.

kernel_shape - INTS : The shape of the convolution kernel. If not present, should be inferred from input W.

cucibala commented 1 week ago

For a quick validation on OnnxRuntime, can you modify your xml as follows?:

From

<layer id="707" name="Result_22666" type="Result" version="opset1">
          <input>
              <port id="0">
                  <dim>1</dim>
                  <dim>128</dim>
              </port>
          </input>
</layer>

To

<layer id="707" name="Result_22666" type="Result" version="opset1">
          <input>
              <port id="0" precision="FP32">
                  <dim>1</dim>
                  <dim>128</dim>
              </port>
          </input>
</layer>

image cause another error

LoSealL commented 1 week ago

root caused, will fix this issue

cucibala commented 1 week ago

When I load a model using OpenCV, I get the following error OpenCV(4.5.4) F:\repos\opencv-4.5.4\modules\dnn\src\onnx\onnx_importer.cpp:739: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20211004::ONNXImporter::handleNode'

Node [Conv]:(Convolution_21635_output2) parse error: OpenCV(4.5.4) F:\repos\opencv-4.5.4\modules\dnn\src\layers\layers_common.cpp:106: error: (-5:Bad argument) kernel_size (or kernel_h and kernel_w) not specified in function 'cv::dnn::util::getKernelSize'

For OpenCV, it seems it needs kernel_shape attribute while it is not a mandatory attribute as onnx describes here.

kernel_shape - INTS : The shape of the convolution kernel. If not present, should be inferred from input W.

image I converted the model, but I still get the same error

LoSealL commented 1 week ago

28 solved 2 issues:

For invalid data type 0, keep the change of xml, it suppose to deduce the correct data type automatically

cucibala commented 1 week ago

it's done, thanks