Skip to content
This repository has been archived by the owner on Jul 23, 2024. It is now read-only.

Bump ort from 1.14.8 to 1.15.1 #33

Merged
merged 3 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion chimp_chomp/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
] }
Expand Down
23 changes: 10 additions & 13 deletions chimp_chomp/src/inference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -23,12 +20,11 @@ pub type Masks = Array3<f32>;
///
/// 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<Session, anyhow::Error> {
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(
Expand All @@ -53,7 +49,8 @@ fn do_inference(
.cycle()
.take(batch_size)
.collect::<Vec<_>>();
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()
Expand Down
Loading