fix: update ONNX model loading to use read_net_from_onnx_2_def
This commit is contained in:
@@ -15,7 +15,7 @@ impl HandPose {
|
|||||||
let bytes = Vector::from_slice(include_bytes!(
|
let bytes = Vector::from_slice(include_bytes!(
|
||||||
"../models/handpose_estimation_mediapipe_2023feb.onnx"
|
"../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_backend(dnn::DNN_BACKEND_OPENCV)?;
|
||||||
net.set_preferable_target(dnn::DNN_TARGET_CPU)?;
|
net.set_preferable_target(dnn::DNN_TARGET_CPU)?;
|
||||||
Ok(Self {
|
Ok(Self {
|
||||||
@@ -76,6 +76,7 @@ impl HandPose {
|
|||||||
imgproc::INTER_LINEAR,
|
imgproc::INTER_LINEAR,
|
||||||
core::BORDER_CONSTANT,
|
core::BORDER_CONSTANT,
|
||||||
Scalar::all(0.0),
|
Scalar::all(0.0),
|
||||||
|
core::AlgorithmHint::ALGO_HINT_DEFAULT,
|
||||||
)?;
|
)?;
|
||||||
let mut rgb = Mat::default();
|
let mut rgb = Mat::default();
|
||||||
imgproc::cvt_color_def(&crop, &mut rgb, imgproc::COLOR_BGR2RGB)?;
|
imgproc::cvt_color_def(&crop, &mut rgb, imgproc::COLOR_BGR2RGB)?;
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ impl Detector {
|
|||||||
let bytes = Vector::from_slice(include_bytes!(
|
let bytes = Vector::from_slice(include_bytes!(
|
||||||
"../models/palm_detection_mediapipe_2023feb.onnx"
|
"../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_backend(dnn::DNN_BACKEND_OPENCV)?;
|
||||||
net.set_preferable_target(dnn::DNN_TARGET_CPU)?;
|
net.set_preferable_target(dnn::DNN_TARGET_CPU)?;
|
||||||
let mut anchors = Vec::new();
|
let mut anchors = Vec::new();
|
||||||
|
|||||||
Reference in New Issue
Block a user