ONNX, or Open Neural Network Exchange, is an open format for representing machine-learning models. Its practical value is portability: a model can move between frameworks and tools instead of being tied to the environment in which it was prepared. section 5.2.1
For inference, an ONNX model is loaded as a graph, given tensor input, and asked to compute output. Image data becomes a tensor whose dimensions represent batch, color channels, width, and height; the resulting scores can be converted to probabilities and matched with classification labels. section 5.2.1 section 5.2.2
Run an ONNX image classifier through wasi-nn
Load `squeezenet1.1-7.onnx` with `GraphEncoding::Onnx` and a CPU execution target. Resize and normalize a 224×224 image into a floating-point tensor, run `compute()`, then apply softmax and print the three highest-probability labels. In the demonstrated run, a cat image is classified as a Persian cat with probability 0.9488756. section 5.2.2
Figure 5.2 wasi_nn_example application schematic
Follow the application schematic to see how image input, model inference, and classification output fit together. section 5.2.1
ONNX is one of three experimental wasi-nn backends supported by Wasmtime at the stated point in time, alongside OpenVINO and WinML. The component uses generated bindings for the wasi-nn interface; obtaining that interface is manual because it is not yet packaged as an OCI artifact. section 5.2.2






