Thanks a lot! I’m working on a Sentis tutorial, so this will be really helpful also for my viewers! Video should be up next week ![]()
https://www.youtube.com/@blackwhalestudio
I’m testing the sample from the docs and there is some error but I followed exactly the steps described on this page and used the exact same code: Understand the Sentis workflow | Sentis | 1.0.0-exp.6
AssertionException: ValueError: reshaped length does not match with input length
Assertion failure. Value was False
Expected: True
Edit: I saw you guys changed the code recently. You forgot to specify the height, width and channels of the input tensor. I fixed it in this script. It is working as intended now, feel free to take this and update your documentation with it!
using UnityEngine;
using Unity.Sentis;
public class ClassifyHandwrittenDigit : MonoBehaviour
{
public Texture2D inputTexture;
public ModelAsset modelAsset;
public float[] results;
private Model runtimeModel;
private IWorker worker;
private TensorFloat inputTensor;
void Start()
{
// Load the model
runtimeModel = ModelLoader.Load(modelAsset);
// Create a worker with GPU compute backend
worker = WorkerFactory.CreateWorker(BackendType.GPUCompute, runtimeModel);
// Convert the input texture to a tensor and execute the model
ExecuteModel();
}
void ExecuteModel()
{
// Dispose previous tensor if it exists
inputTensor?.Dispose();
// Create input data as a tensor
inputTensor = TextureConverter.ToTensor(inputTexture, 28, 28, 1);
// Execute the model with the input data
worker.Execute(inputTensor);
// Get the output tensor
TensorFloat outputTensor = worker.PeekOutput() as TensorFloat;
// Make the tensor readable and convert it to an array
outputTensor.MakeReadable();
results = outputTensor.ToReadOnlyArray();
// Dispose of the output tensor after use
outputTensor.Dispose();
}
void OnDisable()
{
// Dispose of resources
inputTensor?.Dispose();
worker.Dispose();
}
}
Hi, your link leads to the Sentis 1.0 documentation. Currently, Sentis is at version 1.3. You can use this link to refer to the documentation of Sentis 1.3:
https://docs.unity3d.com/Packages/com.unity.sentis@1.3/manual/understand-sentis-workflow.html
Well, I knew it looked different lol, sorry for the confusion!
Is there a code example where I can check if the audio file exists in the onnx model?
I’m not sure. Please ask in the Sentis Discussions forum: Sentis - Unity Discussions
Are there any plan to add API related to Federated learning into sentis packages ?
For some reason, I can’t get Sentis 1.3.0 pre3. When I get it through the Package Manager, It loads 1.2.0. Can’t find anyway to get it. 2022.3.15f1.
Use the name + version while adding it or use the package manifest
Could you type it out? I tried ever combo I can and it tells me it can’t find it. i.e. com.unity.sentis 1.3.0-pre.3 tells me it can’t find the package. And I don’t know how to use the package manifest. Thanks!
Did you type the name and version into the right fields?
And go to the packages folder and open the manifest or packages file and edit the value there
I did now. I did not see the blank Box that said version number. Thank you so much. Live and Learn!
