From c751654799ee4402ea984d93f551bd8860cec17c Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Thu, 17 Jul 2025 21:49:50 +0530 Subject: [PATCH] feat: Use the git version of mnn-rs with a patch to local --- Cargo.lock | 2 ++ Cargo.toml | 18 +++++++++++------- src/facedet.rs | 3 ++- 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6b3b227..f6db907 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1210,6 +1210,7 @@ dependencies = [ [[package]] name = "mnn-bridge" version = "0.1.0" +source = "git+https://github.com/uttarayan21/mnn-rs?branch=restructure-tensor-type#6ce7bfda5a030afaca64f72d2e3040a9a3ae6b02" dependencies = [ "error-stack", "mnn", @@ -1219,6 +1220,7 @@ dependencies = [ [[package]] name = "mnn-sync" version = "0.1.0" +source = "git+https://github.com/uttarayan21/mnn-rs?branch=restructure-tensor-type#6ce7bfda5a030afaca64f72d2e3040a9a3ae6b02" dependencies = [ "error-stack", "flume", diff --git a/Cargo.toml b/Cargo.toml index fadc556..543bffa 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,19 +5,23 @@ members = ["ndarray-image", "ndarray-resize", ".", "bounding-box"] version = "0.1.0" edition = "2024" +[patch."https://github.com/uttarayan21/mnn-rs"] +mnn = { path = "/Users/fs0c131y/Projects/aftershoot/mnn-rs" } + [workspace.dependencies] ndarray-image = { path = "ndarray-image" } ndarray-resize = { path = "ndarray-resize" } -mnn = { path = "/home/servius/Projects/mnn-rs", version = "0.2.0", features = [ - "opencl", +mnn = { git = "https://github.com/uttarayan21/mnn-rs", version = "0.2.0", features = [ + "metal", + "coreml", "tracing", -] } -mnn-bridge = { path = "/home/servius/Projects/mnn-rs/mnn-bridge", version = "0.1.0", features = [ +], branch = "restructure-tensor-type" } +mnn-bridge = { git = "https://github.com/uttarayan21/mnn-rs", version = "0.1.0", features = [ "ndarray", -] } -mnn-sync = { path = "/home/servius/Projects/mnn-rs/mnn-sync", version = "0.1.0", features = [ +], branch = "restructure-tensor-type" } +mnn-sync = { git = "https://github.com/uttarayan21/mnn-rs", version = "0.1.0", features = [ "tracing", -] } +], branch = "restructure-tensor-type" } [package] name = "detector" diff --git a/src/facedet.rs b/src/facedet.rs index 214ad33..387cd58 100644 --- a/src/facedet.rs +++ b/src/facedet.rs @@ -93,7 +93,7 @@ impl FaceDetection { model.set_session_mode(mnn::SessionMode::Release); let bc = mnn::BackendConfig::default().with_memory_mode(mnn::MemoryMode::High); let sc = mnn::ScheduleConfig::new() - .with_type(mnn::ForwardType::CPU) + .with_type(mnn::ForwardType::CoreML) .with_backend_config(bc); tracing::info!("Creating session handle for face detection model"); let handle = mnn_sync::SessionHandle::new(model, sc) @@ -103,6 +103,7 @@ impl FaceDetection { } pub fn detect_faces(&self, image: ndarray::Array3) -> Result { + #[rustfmt::skip] use ::tap::*; let output = self .handle