1 use anyhow::{Context, Result}; 2 use std::fs; 3 use test_programs::nn::{sort_results, witx}; 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 = witx::load( 11 &[&xml, &weights], 12 witx::GraphEncoding::Openvino, 13 witx::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 = witx::classify(graph, tensor)?; 18 let top_five = &sort_results(&results)[..5]; 19 println!("found results, sorted top 5: {top_five:?}"); 20 Ok(()) 21 } 22