mirror of
https://github.com/pykeio/ort
synced 2026-04-25 16:34:55 +02:00
refactor: improve onnxruntime logging
This commit is contained in:
@@ -1,14 +1,14 @@
|
||||
use std::path::Path;
|
||||
|
||||
use image::{imageops::FilterType, ImageBuffer, Luma, Pixel};
|
||||
use ort::{download::vision::DomainBasedImageClassification, inputs, ArrayExtensions, GraphOptimizationLevel, LoggingLevel, Session, Tensor};
|
||||
use ort::{download::vision::DomainBasedImageClassification, inputs, ArrayExtensions, GraphOptimizationLevel, Session, Tensor};
|
||||
use test_log::test;
|
||||
|
||||
#[test]
|
||||
fn mnist_5() -> ort::Result<()> {
|
||||
const IMAGE_TO_LOAD: &str = "mnist_5.jpg";
|
||||
|
||||
ort::init().with_name("integration_test").with_log_level(LoggingLevel::Warning).commit()?;
|
||||
ort::init().with_name("integration_test").commit()?;
|
||||
|
||||
let session = Session::builder()?
|
||||
.with_optimization_level(GraphOptimizationLevel::Level1)?
|
||||
|
||||
@@ -7,14 +7,14 @@ use std::{
|
||||
|
||||
use image::{imageops::FilterType, ImageBuffer, Pixel, Rgb};
|
||||
use ndarray::s;
|
||||
use ort::{download::vision::ImageClassification, inputs, ArrayExtensions, FetchModelError, GraphOptimizationLevel, LoggingLevel, Session, Tensor};
|
||||
use ort::{download::vision::ImageClassification, inputs, ArrayExtensions, FetchModelError, GraphOptimizationLevel, Session, Tensor};
|
||||
use test_log::test;
|
||||
|
||||
#[test]
|
||||
fn squeezenet_mushroom() -> ort::Result<()> {
|
||||
const IMAGE_TO_LOAD: &str = "mushroom.png";
|
||||
|
||||
ort::init().with_name("integration_test").with_log_level(LoggingLevel::Warning).commit()?;
|
||||
ort::init().with_name("integration_test").commit()?;
|
||||
|
||||
let session = Session::builder()?
|
||||
.with_optimization_level(GraphOptimizationLevel::Level1)?
|
||||
|
||||
@@ -2,7 +2,7 @@ use std::path::Path;
|
||||
|
||||
use image::RgbImage;
|
||||
use ndarray::{Array, CowArray, Ix4};
|
||||
use ort::{inputs, GraphOptimizationLevel, LoggingLevel, Session, Tensor};
|
||||
use ort::{inputs, GraphOptimizationLevel, Session, Tensor};
|
||||
use test_log::test;
|
||||
|
||||
fn load_input_image<P: AsRef<Path>>(name: P) -> RgbImage {
|
||||
@@ -44,7 +44,7 @@ fn convert_image_to_cow_array(img: &RgbImage) -> CowArray<'_, f32, Ix4> {
|
||||
fn upsample() -> ort::Result<()> {
|
||||
const IMAGE_TO_LOAD: &str = "mushroom.png";
|
||||
|
||||
ort::init().with_name("integration_test").with_log_level(LoggingLevel::Warning).commit()?;
|
||||
ort::init().with_name("integration_test").commit()?;
|
||||
|
||||
let session_data =
|
||||
std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join("tests").join("data").join("upsample.onnx")).expect("Could not open model from file");
|
||||
@@ -85,7 +85,7 @@ fn upsample() -> ort::Result<()> {
|
||||
fn upsample_with_ort_model() -> ort::Result<()> {
|
||||
const IMAGE_TO_LOAD: &str = "mushroom.png";
|
||||
|
||||
ort::init().with_name("integration_test").with_log_level(LoggingLevel::Warning).commit()?;
|
||||
ort::init().with_name("integration_test").commit()?;
|
||||
|
||||
let session_data =
|
||||
std::fs::read(Path::new(env!("CARGO_MANIFEST_DIR")).join("tests").join("data").join("upsample.ort")).expect("Could not open model from file");
|
||||
|
||||
Reference in New Issue
Block a user