When I add onnx model to my project unity shows an error:
Asset import failed, “Assets/mnist-1.onnx” > InvalidProtocolBufferException: Protocol message contained a tag with an invalid wire type.
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.CodedInputStream input) (at T:/src/github/protobuf/csharp/src/Google.Protobuf/UnknownFieldSet.cs:232)
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.UnknownFieldSet unknownFields, Google.Protobuf.CodedInputStream input) (at T:/src/github/protobuf/csharp/src/Google.Protobuf/UnknownFieldSet.cs:257)
Onnx.ModelProto.MergeFrom (Google.Protobuf.CodedInputStream input) (at Library/PackageCache/com.unity.barracuda@0.7.1-preview/Barracuda/Editor/Generated/Onnx.cs:1645)
Unity.Barracuda.ONNXModelImporter.OnImportAsset (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/com.unity.barracuda@0.7.1-preview/Barracuda/Editor/ONNXModelImporter.cs:952)
UnityEditor.Experimental.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.Experimental.AssetImporters.AssetImportContext ctx) (at /Users/builduser/buildslave/unity/build/Modules/AssetPipelineEditor/Public/ScriptedImporter.cs:22)
So I can’t add onnx model as NNModel field in unity inspector. Any ideas? What should I do?
I’m trying to follow this guide
Most likely your your onnx file is broken. Could you please post it here?
I’ve take onnx file from here
ok, i figured it out.
It was wrong version of onnx model format.
if you have same problem:
go to barakuda github
go to barracuda-release/Tools/requirements.txt
there is a line with onnx version requirement
find model with version you need
Having the same problem. Does step 4 mean that the model was created with the same onnx version as used by the current barracuda release (from requirements.txt)?
This is a really frustrating issue. Trying to get the asset import working for 2 days now.
If you are getting a error in Google.Protobuf the problem is most likely that your onnx model is corrupted.
Try loading it in onnxruntime to see if it complains.
If you manage to load it in onnxruntime, we might have a problem on our end