EnoxSoftware / OpenCVForUnity

OpenCV for Unity (Untiy Asset Plugin)
https://assetstore.unity.com/packages/tools/integration/opencv-for-unity-21088
550 stars 172 forks source link

YOLOX ONNX Model Dnn.readNet error #181

Open tv-gc opened 5 months ago

tv-gc commented 5 months ago

Hi!

I am trying to run this model

https://github.com/TexasInstruments/edgeai-yolox/blob/main/README_6d_pose.md

using either the regular or lite versions

image

but i am getting an error from Dnn.readNet module, failing to parse the files.

\Users\satoo\Desktop\opencv\modules\dnn\src\caffe\caffe_io.cpp:1176: error: (-2:Unspecified error) FAILED: ReadProtoFromBinaryFile(param_file, param). Failed to parse NetParameter file

Are these supported? If not, is it possible to adapt the code to successfully parse them?

I am using the yolov5 repo to test this btw.

Cheers!

EnoxSoftware commented 5 months ago

I tried the onnx model (yolox_s_object_pose.onnx) distributed on that site with python opencv and got the following error.

error: (-2:Unspecified error) Can't create layer "onnx_node!/1/NonZero" of type "NonZero" in function 'cv::dnn::dnn4_v20231225::Net::Impl::. getLayerInstance'

It appears that the model contains a layer (NonZero) that is not supported by the latest opencv dnn module. Unfortunately, the only solution I can think of to this problem is to submit an update request to the opencv development community.

Alternatively, you might consider using a plugin that allows direct access to the ONNX runtime in Unity, such as the following https://github.com/asus4/onnxruntime-unity