Making Predictions with tflite models

Is it possible to make predictions with tflite models on openmv where the input into the model is an array and not images…from the documentation I see the tf.classify function but seems to me that’s for images…

Please help.

Not yet. Please make an issue here for that: Issues · openmv/openmv · GitHub

Ok I think I made that… in the meantime is there anyone who has worked withe cubeAI library? I think that has the capability to predict arrays?


I saw that the issue has been closed and the capability has been added. However it is not clear to me how I can utilize this function, do I simple need to install the latest firmware? Also, what function does the prediction?

It’s not documented yet. But, there’s a new method in the latest firmware:

tf.regression(model, array) or net.regression(array)

It will take a 1d array that fits the model’s input and it will then output another 1d array.

I didn’t make this method so I haven’t tested it yet.

ok, thank you. Will try it out.

Thanks, so i have a tflite neural network model where the output layer is softmax i.e. should give an array of probabilities. My feeling is if have an input 1D array and use tf.regression, the output 1D array should be an array indicating the probability of the input belonging to each class in the model. But when I try with two different inputs, I get the same answer an output array of [0,1]. This is wrong because the examples belong to different classes so should give a different answer. Is there a way I can use tf.regression for this problem or am I doing something wrong?

Hi, I don’t know exactly. The function was contributed to our firmware by a user. I just added it to the documentation. To verify if there’s a bug I would need a know working use case to compare with.