Thanks @alexandreribard_unity@liutaurasvysniauskas_unity i guess i will just reshape the images to 320x320 and try again cause i dont know how to do the other think u suggested. Im following this tutorial:
Thank u, could you give me a usage example? Im currently doing this:
void Start()
{
// Create the runtime model
runtimeModel = ModelLoader.Load(modelAsset);
// Create input data as a tensor
Tensor inputTensor = TextureConverter.ToTensor(inputTexture);
// Create an engine
worker = WorkerFactory.CreateWorker(BackendType.GPUCompute, runtimeModel);
// Run the model with the input data
worker.Execute(inputTensor);
// Get the result
TensorFloat outputTensor = worker.PeekOutput() as TensorFloat;
results = outputTensor.ToReadOnlyArray();
}
Oh missed that, your model is NHWC and not NCHW Tensor inputTensor = TextureConverter.ToTensor(inputTexture, new TextureTransform().SetDimensions(width: 320, height: 320).SetTensorLayout(TensorLayout.NHWC)
Looking at your code you are not disposing the input tensor that you’ve allocated.
Also the labels, it depends on your model. Typically the model gives you a probability per class.
You then need to take the softmax/argmax and map that to your string labels
You can follow the ExecuteOperatorOnTensor sample
Ok so i get around 19k floats which could be a label each cause its a large model. But i should also be getting back bounding boxes too cause how do i know where it was detected?
Isn’t mobilenet outputting label probability only? Checking the tutorial I’m assuming you get a 1,1000 output. which you apply softmax and argmax. you then sample the dictionary labels.json to get the label.
If your model works with bounding box then my guess is you get some tensor of 1,1000,4 and in this case it’s the uv coord for the bounding box per class.
I’d check the shape of the output tensor and check the tutorial on what is the output supposed to mean
TensorFloat(1, 19206, 90) this is the tensor i get which doesnt make much sense. 19k for labels are too many and no clue what 90 is. but the same model used in js outputs label, probability and bounding boxes so the data do exists in it