Runs the ONNX model on an extracted feature vector and decodes the result.
The model takes a {batch, beg_size + end_size} int32 tensor named bytes
and returns a {batch, n_labels} float32 tensor of per-label probabilities
(a softmax). We take the argmax to get the predicted label index and its
score.
Summary
Functions
Predicts the content type label and score for a single feature vector.
Predicts for a batch of feature vectors at once.
Functions
@spec predict(OnnxRuntime.Model.t(), [non_neg_integer()], [String.t()]) :: {String.t(), float()}
Predicts the content type label and score for a single feature vector.
features is the list of integers produced by Magika.Features.extract/2,
and labels is the ordered target_labels_space (index → label name).
Returns {label, score}.
@spec predict_batch(OnnxRuntime.Model.t(), [[non_neg_integer()]], [String.t()]) :: [ {String.t(), float()} ]
Predicts for a batch of feature vectors at once.
Returns a list of {label, score} tuples, one per input row, in order.