1 use anyhow::{Context, Result};
2 use std::fs;
3 use test_programs::nn::{sort_results, wit};
4 
5 pub fn main() -> Result<()> {
6     let xml = fs::read("fixture/model.xml")
7         .context("the model file to be mapped to the fixture directory")?;
8     let weights = fs::read("fixture/model.bin")
9         .context("the weights file to be mapped to the fixture directory")?;
10     let graph = wit::load(
11         &[xml, weights],
12         wit::GraphEncoding::Openvino,
13         wit::ExecutionTarget::Cpu,
14     )?;
15     let tensor = fs::read("fixture/tensor.bgr")
16         .context("the tensor file to be mapped to the fixture directory")?;
17     let results = wit::classify(
18         graph,
19         ("input", tensor),
20         "MobilenetV2/Predictions/Reshape_1",
21     )?;
22     let top_five = &sort_results(&results)[..5];
23     println!("found results, sorted top 5: {top_five:?}");
24     Ok(())
25 }
26