From 02d879b7da1f59529d1c6bfcf7b8ad2ce8434fe8 Mon Sep 17 00:00:00 2001 From: bankosegger Date: Fri, 13 Nov 2026 10:29:07 +0100 Subject: [PATCH] fix: update ONNX model loading to use read_net_from_onnx_2_def --- src/hand_pose.rs | 3 ++- src/palm.rs | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/hand_pose.rs b/src/hand_pose.rs index 97c0d7f..0ffc6d2 100644 --- a/src/hand_pose.rs +++ b/src/hand_pose.rs @@ -15,7 +15,7 @@ impl HandPose { let bytes = Vector::from_slice(include_bytes!( "../models/handpose_estimation_mediapipe_2023feb.onnx" )); - let mut net = dnn::read_net_from_onnx_buffer(&bytes)?; + let mut net = dnn::read_net_from_onnx_2_def(&bytes)?; net.set_preferable_backend(dnn::DNN_BACKEND_OPENCV)?; net.set_preferable_target(dnn::DNN_TARGET_CPU)?; Ok(Self { @@ -76,6 +76,7 @@ impl HandPose { imgproc::INTER_LINEAR, core::BORDER_CONSTANT, Scalar::all(0.0), + core::AlgorithmHint::ALGO_HINT_DEFAULT, )?; let mut rgb = Mat::default(); imgproc::cvt_color_def(&crop, &mut rgb, imgproc::COLOR_BGR2RGB)?; diff --git a/src/palm.rs b/src/palm.rs index 82d6fab..20895f7 100644 --- a/src/palm.rs +++ b/src/palm.rs @@ -30,7 +30,7 @@ impl Detector { let bytes = Vector::from_slice(include_bytes!( "../models/palm_detection_mediapipe_2023feb.onnx" )); - let mut net = dnn::read_net_from_onnx_buffer(&bytes)?; + let mut net = dnn::read_net_from_onnx_2_def(&bytes)?; net.set_preferable_backend(dnn::DNN_BACKEND_OPENCV)?; net.set_preferable_target(dnn::DNN_TARGET_CPU)?; let mut anchors = Vec::new();