UnaNancyOwen / MobileSAM-Unity

Sample Unity App for MobileSAM with HoloLab DNN Packages
MIT License
14 stars 1 forks source link

import error for .onnx files #2

Closed cancaglar closed 3 months ago

cancaglar commented 3 months ago

Hi I just tested your project with Unity 6000.0.7f1 and editor can't import the models. Is there have any idea why Unity does this? Thank you!

InvalidProtocolBufferException: Protocol message contained a tag with an invalid wire type.
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.ParseContext& ctx) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.UnknownFieldSet unknownFields, Google.Protobuf.ParseContext& ctx) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.UnknownFieldSet unknownFields, Google.Protobuf.CodedInputStream input) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Onnx.ModelProto.MergeFrom (Google.Protobuf.CodedInputStream input) (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/Onnx.cs:1645)
Unity.Sentis.ONNX.ONNXModelConverter.Convert () (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/ONNXModelConverter.cs:34)
Unity.Sentis.ONNXModelImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/ONNXModelImporter.cs:30)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <6837c0a96c954c9d811b8aa28b6da0c9>:0)
Asset import failed, "Assets/Samples/SampleApp/Models/encoder.onnx" > InvalidProtocolBufferException: Protocol message contained a tag with an invalid wire type.
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.ParseContext& ctx) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.UnknownFieldSet unknownFields, Google.Protobuf.ParseContext& ctx) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.UnknownFieldSet unknownFields, Google.Protobuf.CodedInputStream input) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Onnx.ModelProto.MergeFrom (Google.Protobuf.CodedInputStream input) (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/Onnx.cs:1645)
Unity.Sentis.ONNX.ONNXModelConverter.Convert () (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/ONNXModelConverter.cs:34)
Unity.Sentis.ONNXModelImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/ONNXModelImporter.cs:30)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <6837c0a96c954c9d811b8aa28b6da0c9>:0)
Asset import failed, "Assets/Samples/SampleApp/Models/decoder.onnx" > InvalidProtocolBufferException: Protocol message contained a tag with an invalid wire type.
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.ParseContext& ctx) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.UnknownFieldSet unknownFields, Google.Protobuf.ParseContext& ctx) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Google.Protobuf.UnknownFieldSet.MergeFieldFrom (Google.Protobuf.UnknownFieldSet unknownFields, Google.Protobuf.CodedInputStream input) (at <f241bc9013e1492a90cb7ea9784513ec>:0)
Onnx.ModelProto.MergeFrom (Google.Protobuf.CodedInputStream input) (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/Onnx.cs:1645)
Unity.Sentis.ONNX.ONNXModelConverter.Convert () (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/ONNXModelConverter.cs:34)
Unity.Sentis.ONNXModelImporter.OnImportAsset (UnityEditor.AssetImporters.AssetImportContext ctx) (at ./Library/PackageCache/com.unity.sentis/Editor/ONNX/ONNXModelImporter.cs:30)
UnityEditor.AssetImporters.ScriptedImporter.GenerateAssetData (UnityEditor.AssetImporters.AssetImportContext ctx) (at <6837c0a96c954c9d811b8aa28b6da0c9>:0)
UnaNancyOwen commented 3 months ago

If you download this project as zip from GitHub page, I think ONNX files is not included in that. ONNX files included in this repository are managed with git lfs. Please clone repository to local using git command.

cancaglar commented 3 months ago

Well it's worked Thank you so much And I just realize when I build for Android Unity editor give me an error "Vector2' does not contain a definition for 'Abs' and no accessible extension method 'Abs' accepting a first argument of type 'Vector2' could be found" for Selector.cs And I just Use my static function for it

public static class Helper
{
    public static Vector2 Abs(this Vector2 v)
    {
        return new Vector2(Mathf.Abs(v.x), Mathf.Abs(v.y));
    }
}

I just wanted to say. Thank you!

UnaNancyOwen commented 3 months ago

Thanks, It is fixed now.