i am having this error : error CS0021: Cannot apply indexing with [] to an expression of type 'Tensor'

#3
by razdev0303 - opened

i am having this error : error CS0021: Cannot apply indexing with [] to an expression of type 'Tensor' in these lines:
var box = new BoundingBox
{
centerX = output[0, n, 0] * scaleX - displayWidth / 2,
centerY = output[0, n, 1] * scaleY - displayHeight / 2,
width = output[0, n, 2] * scaleX,
height = output[0, n, 3] * scaleY,
label = labels[labelIDs[0, 0,n]],
};

Hi. Are you using Unity 2023 and updated to the latest Sentis package?
If you are using Unity 2021 you might be able to use the package com.unity.sentis version 1.3.0-pre.3

hin thank you very much for your answer it helped and the error is gone, now i am having a trouble finding the results of the inference ,where can i find the results?
thank you in advance

After output.MakeReadable();
If you write Debug.Log(string.Join(",",output.ToReadOnlyArray());
for example it should list all the numbers for the output.
Similarly for labels

and we would really appreciate if you do a project for realtime object detection how to get the input from webcam and give it to the model

Hi check out the Blaze Face model. It has an example of using the webcam. You should be able to adapt the code for your purposes?

Hi again i was not able to comment because my account is still new, i am trying to run an object detection model in unity using sentis packege 1.3.0 and unity2023, i have downloaded a project that is similar to mine provided by you. however when i am trying to do the same with my model i get this error:
[ NotSupportedException: Format version not supported: 118621192, please reimport model.
Unity.Sentis.ModelLoader.LoadModelDesc (System.IO.Stream stream, Unity.Sentis.Model& model) (at ./Library/PackageCache/com.unity.sentis@1.3.0-pre.3/Runtime/Core/ModelLoader.cs:188)
Unity.Sentis.ModelLoader.Load (System.IO.Stream stream) (at ./Library/PackageCache/com.unity.sentis@1.3.0-pre.3/Runtime/Core/ModelLoader.cs:66)
Unity.Sentis.ModelLoader.Load (System.String path) (at ./Library/PackageCache/com.unity.sentis@1.3.0-pre.3/Runtime/Core/ModelLoader.cs:54)
webcam_inference.LoadModel () (at Assets/assets/YOLO/scripts/webcam_inference.cs:82)
webcam_inference.Start () (at Assets/assets/YOLO/scripts/webcam_inference.cs:67)
]
note: yourproject two files: 1 is model.onnx and the other is model.sentis (which i don’t what it is and i don’t know how to get for my custom model)
any ideas?
thank you in advance

Hi, to create a sentis from the onnx file you can look here

Sign up or log in to comment