Closed cgreening closed 2 years ago
The callback approach is not the best and dates from the very beginning (January 2021) when I didn't know how anything worked.
I plan to change how the interpreter works in #10 to try and line up as a subset of the tensorflow lite python Interpreter API.
I just took a look at your question on my m5 camera board and its possible to not use the callbacks but at the moment you have to stub a specific kind of no-op function.
def noop(interp):
pass
interp = microlite.interpreter(model, 4096, noop, noop)
inputTensor = microlite_interpreter.getInputTensor(0)
# fill the input tensor with data
outputTensor = microlite_interpreter.getOutputTensor(0)
interp.invoke()
result = outputTensor.getValue(0)
I'll make an API change on this issue so that if you don't set callbacks don't use them.
i.e.
interp = microlite.interpreter(model, 4096)
inputTensor = microlite_interpreter.getInputTensor(0)
# fill the input tensor with data
outputTensor = microlite_interpreter.getOutputTensor(0)
interp.invoke()
result = outputTensor.getValue(0)
I think it should be a minor adjustment to the interpreter constructor
and the invoke method.
It seemed like it was a little bit faster without the function calls.
That works nicely!
I'm fairly new to Micropython, so this might not be the way things work.
Is it possible to use the interpreter without input and output callbacks?
e.g.