Unity-Technologies / barracuda-release

Other
564 stars 76 forks source link

[ Error to load ONNX model from Azure Custom Vision AI ](Unsupported default attribute `split` for node pred_centers of type Split. Value is required.) #288

Closed robot-park closed 2 years ago

robot-park commented 2 years ago

I trained my own object detection model using Microsoft Custom Vision service. I used Compact(S1) for my Domain which is a general choice for mobile and edge computer.

When I drag my .onnx file to unity project tab, console prints error like this. How can I solve this issue?

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

Json: { "input": [ "mbox_loc" ], "output": [ "pred_centers", "pred_sizes" ], "name": "split", "opType": "Split", "attribute": [ { "name": "axis", "i": "2", "type": "INT" } ] }
  at Unity.Barracuda.ONNX.ONNXModelConverter+<>c.<UseStandardImporter>b__27_10 (Unity.Barracuda.ModelBuilder net, Unity.Barracuda.ONNX.ONNXNodeWrapper node) [0x00017] in C:\Users\dudrj\Documents\GitHub\Metaverse\Metaverse\Library\PackageCache\com.unity.barracuda@3.0.0\Barracuda\Runtime\ONNX\ONNXModelConverter.cs:389 
  at Unity.Barracuda.ONNX.ONNXModelConverter.ConvertOnnxModel (Onnx.ModelProto onnxModel) [0x00409] in C:\Users\dudrj\Documents\GitHub\Metaverse\Metaverse\Library\PackageCache\com.unity.barracuda@3.0.0\Barracuda\Runtime\ONNX\ONNXModelConverter.cs:2934 

Unity.Barracuda.ONNX.ONNXModelConverter.Err (Unity.Barracuda.Model model, System.String layerName, System.String message, System.String extendedMessage, System.String debugMessage) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/ONNX/ONNXModelConverter.cs:3434)
Unity.Barracuda.ONNX.ONNXModelConverter.ConvertOnnxModel (Onnx.ModelProto onnxModel) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/ONNX/ONNXModelConverter.cs:2943)
Unity.Barracuda.ONNX.ONNXModelConverter.Convert (Google.Protobuf.CodedInputStream inputStream) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/ONNX/ONNXModelConverter.cs:170)
Unity.Barracuda.ONNX.ONNXModelConverter.Convert (System.String filePath) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Runtime/ONNX/ONNXModelConverter.cs:98)
Unity.Barracuda.ONNXModelImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at Library/PackageCache/com.unity.barracuda@3.0.0/Barracuda/Editor/ONNXModelImporter.cs:65)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <36f62d8e760b48f7af5d32916f997ce1>:0)
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr, Boolean&)

pred_centers

(red line part is "pred_centers" where error popped)

felix-ulonska commented 2 years ago

We are also impacted by this and have great interest in possible workarounds.

Arminasss commented 2 years ago

Hi @YounggeonPark! Sorry for the inconvenience, but currently, the Split operator is not supported, so the only workaround would be to edit the graph and remake the logic by splitting the unsupported op into supported ones (if possible). The alternative is to wait for Barracuda 4.0.0 and add it by yourself (there will be a feature to add wanted operators or expand their functionality through API). Or if there will be a big demand for it, we might include it in the Barracuda package in later releases. Hope I was able to answer your question and again, sorry for the inconvenience, cheers!