From 52311167f78c18d60c8f651ac7d944f3416673d6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 18 Jul 2023 10:53:30 +0000 Subject: [PATCH 1/3] Bump ort from 1.14.8 to 1.15.1 Bumps [ort](https://github.com/pykeio/ort) from 1.14.8 to 1.15.1. - [Release notes](https://github.com/pykeio/ort/releases) - [Commits](https://github.com/pykeio/ort/commits/v1.15.1) --- updated-dependencies: - dependency-name: ort dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- Cargo.lock | 4 ++-- chimp_chomp/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 753074c5..a0b6a1ff 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2049,9 +2049,9 @@ dependencies = [ [[package]] name = "ort" -version = "1.14.8" +version = "1.15.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "562aedddfc14391badc2e527fd568164bd2fb108e2572cd3fe0b53ed440ec439" +checksum = "df8602d59762c7fad45311d370da7a8eeb089f6f983cd034a9ddf1d4ff2781d0" dependencies = [ "flate2", "lazy_static", diff --git a/chimp_chomp/Cargo.toml b/chimp_chomp/Cargo.toml index fd25a200..e1e4e5a4 100644 --- a/chimp_chomp/Cargo.toml +++ b/chimp_chomp/Cargo.toml @@ -20,7 +20,7 @@ opencv = { version = "0.82.1", default-features = false, features = [ "imgproc", "imgcodecs", ] } -ort = { version = "1.14.8", default-features = false, features = [ +ort = { version = "1.15.1", default-features = false, features = [ "download-binaries", "copy-dylibs", ] } From 9dd1d26462d1c5220c78a93d69a0ab088e18759e Mon Sep 17 00:00:00 2001 From: Garry O'Donnell Date: Tue, 18 Jul 2023 12:15:41 +0000 Subject: [PATCH 2/3] Update inference data creation --- chimp_chomp/src/inference.rs | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) diff --git a/chimp_chomp/src/inference.rs b/chimp_chomp/src/inference.rs index afd07afc..20383679 100644 --- a/chimp_chomp/src/inference.rs +++ b/chimp_chomp/src/inference.rs @@ -2,12 +2,9 @@ use crate::image_loading::ChimpImage; use anyhow::Context; use chimp_protocol::Job; use itertools::{izip, Itertools}; -use ndarray::{Array1, Array2, Array3, Axis, Ix1, Ix2, Ix4}; -use ort::{ - tensor::{FromArray, InputTensor}, - Environment, ExecutionProvider, GraphOptimizationLevel, Session, SessionBuilder, -}; -use std::{env::current_exe, ops::Deref, sync::Arc}; +use ndarray::{Array1, Array2, Array3, Axis, CowArray, Ix1, Ix2, Ix4}; +use ort::{Environment, ExecutionProvider, GraphOptimizationLevel, Session, SessionBuilder, Value}; +use std::{env::current_exe, ops::Deref}; use tokio::sync::mpsc::{error::TryRecvError, Receiver, UnboundedSender}; /// The raw box predictor output of a MaskRCNN. @@ -23,12 +20,11 @@ pub type Masks = Array3; /// /// Returns an [`anyhow::Error`] if the environment could not be built or if the model could not be loaded. pub fn setup_inference_session() -> Result { - let environment = Arc::new( - Environment::builder() - .with_name("CHiMP") - .with_execution_providers([ExecutionProvider::cpu()]) - .build()?, - ); + let environment = Environment::builder() + .with_name("CHiMP") + .with_execution_providers([ExecutionProvider::CPU(Default::default())]) + .build()? + .into_arc(); Ok(SessionBuilder::new(&environment)? .with_optimization_level(GraphOptimizationLevel::Level3)? .with_model_from_file( @@ -53,7 +49,8 @@ fn do_inference( .cycle() .take(batch_size) .collect::>(); - let input = InputTensor::from_array(ndarray::stack(Axis(0), &batch_images).unwrap().into_dyn()); + let input_array = CowArray::from(ndarray::stack(Axis(0), &batch_images).unwrap().into_dyn()); + let input = Value::from_array(session.allocator(), &input_array).unwrap(); let outputs = session.run(vec![input]).unwrap(); outputs .into_iter() From 2034dab1e7ec5ef102909835d9847b347f885649 Mon Sep 17 00:00:00 2001 From: Garry O'Donnell Date: Tue, 18 Jul 2023 12:31:43 +0000 Subject: [PATCH 3/3] Update libonnxruntime version in dockerfile --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 0b5a536f..cb15adbb 100644 --- a/Dockerfile +++ b/Dockerfile @@ -50,7 +50,7 @@ RUN touch chimp_chomp/src/lib.rs \ RUN mkdir /chimp_chomp_libraries \ && cp \ $(ldd /app/target/release/chimp_chomp | grep -o '/.*\.so\S*') \ - /app/target/release/libonnxruntime.so.1.14.1 \ + /app/target/release/libonnxruntime.so.1.15.1 \ /chimp_chomp_libraries FROM gcr.io/distroless/cc as chimp_chomp