A BB.Inference.Runtime that runs .tflite models through
tflite_elixir.
model :detector do
runtime BB.Inference.TFLite
source "https://storage.googleapis.com/download.tensorflow.org/models/tflite/coco_ssd_mobilenet_v1_1.0_quant_2018_06_29.zip"
archive_member "detect.tflite"
sha256 "e4b118e5e4531945de2e659742c7c590f7536f8d0ed26d135abcfe83b4779d13"
codec BB.Estimator.ObjectDetection.FinalDetections
endQuantised models
Quantised tensors pass through as they are. describe/1 reports each
tensor's raw type - {:u, 8}, {:s, 8} - and its scale and zero point as a
BB.Inference.Quantisation: per-tensor where the model has one scale, and
per-axis, with the axis, where it has one per channel. run/2 takes inputs
already in that raw type and returns outputs in theirs. The codec
quantises and dequantises, where it is cheap.
What describe/1 can't report
- layout - always
nil. TFLite tensors carry no layout; NHWC is a convention, and codecs infer it from the shape.
The interpreter
A TFLite interpreter belongs to one process. The model's controller is the
only process that calls run/2, so calls are serialised there.
Options
:threads- interpreter threads. Defaults to the number of online schedulers.