This is the Netron output:
input float32[1,64,256,3]
output 0 float32[1,1,4]
output 1 float32[1,1]
output 2 int32[1,1]
output 3 int32[1]
output 4 int32[1]
I’ve (almost) solved the problem. I 've create a float for the output 0
new float[1][xx][4];
and so on.
new code that works ok only if i know previoulsy that there will be 7 objects detected:
Object inputs = {byteBuffer};
Map<Integer, Object> outputs = new HashMap<>();
tflite = new Interpreter(loadModel(MainActivity.this));
int index0 = new int[1];
int index1 = new int[1][7];
float index2 = new float[1][7];
int index3 = new int[1];
float index4 = new float[1][7][4];
I do not think the .tflite file is created in the right way.
Unfortunately you have to prepare a python notebook with the code you used to convert your model to .tflite so I can see and suggest changes.
Check a little bit the example app from TF Lite documentation for Object detection that uses the Task Library
The model has been supplied by another company, it has not been developed by my.
I will ask them If possible to send the script.
I checked the example you suggest some days ago. This is not the exact example because I have to use an InterpreterApi object to run the inference.
Maybe you have an example about how to get te options objects for the InterpreterApi object by the way?
The error is due to a data type mismatch: your model’s output tensor expects a different data type than the one you’re providing through your Java Buffer. Ensure your TensorBuffer data types match the model’s output tensor data types (e.g., use DataType.FLOAT32 instead of DataType.UINT8 if required). Adjust the TensorBuffer creation in your code accordingly to resolve the issue.
I did it but still the same problem. I’ve solved the issue with the following workaround:
I run the model and only read:
output 3 int32[1]
output 4 int32[1]
One of these outputs tells me the number of elements (N) the model has detected.
Then I run de model again whith
output 0 float32[1,N,4]
output 1 float32[1,N]
output 2 int32[1,N]
Then everything is working ok. But i believe this is not the right way.
Anyway, can anybody provide me with an example about how to create the options instance needed for the InterpreterApi.create( fileNameModel, Options) method???