fix: update ONNX model loading to use read_net_from_onnx_2_def

This commit is contained in:
bankosegger
2026-11-13 10:29:07 +01:00
parent b71e2b32e6
commit 02d879b7da
2 changed files with 3 additions and 2 deletions

View File

@@ -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)?;

View File

@@ -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();