Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Model that runs fine in onnxruntime throws warning and gives incorrect results in barracuda #271

Closed
matthiasseibold opened this issue Mar 26, 2022 · 5 comments

Comments

@matthiasseibold
Copy link

matthiasseibold commented Mar 26, 2022

Hi all,

I've been trying to port the following code to barracuda (Unity 2020.3.31f1 with Barracuda 3.0.0.):
https://github.com/ibaiGorordo/ONNX-Mobile-Human-Pose-3D

The model can be imported correctly in onnxruntime, but shows the following warnings in the inspector:

Warnings 3
595 Unsupported attribute nearest_mode, node 595 of type Resize. Value will be ignored and defaulted to round_prefer_floor.
609 Unsupported attribute nearest_mode, node 609 of type Resize. Value will be ignored and defaulted to round_prefer_floor.
623 Unsupported attribute nearest_mode, node 623 of type Resize. Value will be ignored and defaulted to round_prefer_floor.

The onnx model can be downloaded here:
https://drive.google.com/uc?export=download&id=1vvjUsP_41Nqhj8oqRw2OpWjIdz8t5fxG

I can run the model in barracuda, but the results differ from the ones generated in onnxruntime.


Furthermore, I've tried to convert the original TFLITE model provided by the authors
https://github.com/tucan9389/PoseEstimation-TFLiteSwift/releases/download/v2.1.0/lightweight_baseline_choi.tflite
to ONNX using https://github.com/onnx/tensorflow-onnx

and the command
python -m tf2onnx.convert --opset 13 --tflite tflite--file --output model.onnx

The resulting model again runs fine in python with onnxruntime but this time I cannot import the model to unity, it throws the error:

Asset import failed, "Assets/Models/model.onnx" > OnnxImportException: Unexpected error while parsing layer split_1 of type Split.
Unsupported default attribute `split` for node split_1 of type Split. Value is required.

Is there any way to make the model run in barracuda? Any help would be greatly appreciated!

Thanks,
Matthias

@rfilkov
Copy link

rfilkov commented Mar 31, 2022

Any update on this one?

@FlorentGuinier
Copy link

FlorentGuinier commented Apr 1, 2022

Hi @rfilkov

Furthermore, I've tried to convert the original TFLITE model provided by the authors
...
python -m tf2onnx.convert --opset 13 --tflite tflite--file --output model.onnx

Indeed at the moment Barracuda does not support the "split" optional parameter from Split operator version 13. We are currently extending Barracuda range of supported operators and architectures however we don't have ETA to share yet. Something to try is to export the model as opset 9. Witch is at the moment a good target version in term of supported operator for Barracuda.

Opset 9 would mean Split will be version 2
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#Split-2
Opset 11/Split 11 is also without the "split" optional parameters
https://github.com/onnx/onnx/blob/main/docs/Changelog.md#Split-11

@FlorentGuinier
Copy link

In regard to pose estimation for Barracuda this ressource can be helpfull imho: https://github.com/keijiro/BodyPixBarracuda

@matthiasseibold
Copy link
Author

matthiasseibold commented Apr 5, 2022

Thank you for the reply!

With opset 9 I get the same error when trying to import the ONNX model in python, I use the command:

python -m tf2onnx.convert --opset 9 --tflite lightweight_baseline_choi.tflite --output model_opset_9.onnx

and get the error:

OnnxImportException: Unexpected error while parsing layer split_1 of type Split.
Unsupported default attribute `split` for node split_1 of type Split. Value is required.

Is there any feedback about the warnings of the original onnx model that I was trying to import (in my first post)?

@matthiasseibold
Copy link
Author

matthiasseibold commented Apr 5, 2022

In regard to pose estimation for Barracuda this ressource can be helpfull imho: https://github.com/keijiro/BodyPixBarracuda

thanks, but this does not seem to support 3D human pose estimation.

However, in the meantime I found a repository that contains a working example of 3D human pose estimation using a VRect onnx model with barracuda:
https://github.com/digital-standard/ThreeDPoseUnityBarracuda

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants