Worked examples tying the API together. Requires :nx.
These are meant to be read and copied, not called as a stable API. They run on the Orange Pi 6 target (real NPU) only.
Summary
Functions
Loads an image-classifier .cix model, runs one inference on
input_binary, and returns the top-k {class_index, score} pairs.
Functions
@spec classify(Path.t(), binary(), pos_integer()) :: {:ok, [{non_neg_integer(), float()}]} | {:error, String.t()}
Loads an image-classifier .cix model, runs one inference on
input_binary, and returns the top-k {class_index, score} pairs.
Assumes a single input tensor and a single 1-D output of class scores.
Example
iex> CixP1.Examples.classify("/data/models/mobilenet.cix", jpeg_pixels, 5)
{:ok, [{285, 0.71}, {283, 0.10}, ...]}