Path: blob/main/crates/wasi-nn/examples/classification-example-winml/README.md
2459 views
This example project demonstrates using the wasi-nn API to perform WinML-based inference. We first build Wasmtime, a fast and secure runtime for WebAssembly, and then build a WebAssembly example, which:
reads an input image from
fixture/kitten.png,converts it to the correct tensor format,
and then classifies the image using
fixture/mobilenet.onnx
To run this example, perform the following steps on Windows 10 v1803 and later:
Build Wasmtime according to the build guide, but enable the
winmlfeature:Navigate to this directory from Wasmtime's top-level directory (referred to later as `%PROJECT_DIR%).
Install the
wasm32-wasip1Rust target:Compile this example; the
wasm32-wasip1output is a WebAssembly file:Run the sample; the fixture directory containing the model and image must be mapped in to be accessible to WebAssembly.
The example will print the top 5 classification results. To run with a different image or ONNX model, modify the files in the
fixturedirectory along with any path changes this may causesrc/main.rs.