From 087d84195980970710461c5a9b0eb79922690175 Mon Sep 17 00:00:00 2001 From: uttarayan21 Date: Mon, 18 Aug 2025 12:03:00 +0530 Subject: [PATCH] fix: Change the structure of builder --- src/facedet/retinaface/mnn.rs | 7 ++++--- src/facedet/retinaface/ort.rs | 10 +++++----- src/main.rs | 4 ++-- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/facedet/retinaface/mnn.rs b/src/facedet/retinaface/mnn.rs index 4a513f8..94c2346 100644 --- a/src/facedet/retinaface/mnn.rs +++ b/src/facedet/retinaface/mnn.rs @@ -56,9 +56,10 @@ impl FaceDetectionBuilder { } impl FaceDetection { - pub fn builder>() - -> fn(T) -> std::result::Result> { - FaceDetectionBuilder::new + pub fn builder>( + model: T, + ) -> std::result::Result> { + FaceDetectionBuilder::new(model) } pub fn new(path: impl AsRef) -> Result { diff --git a/src/facedet/retinaface/ort.rs b/src/facedet/retinaface/ort.rs index e57cbbc..6349423 100644 --- a/src/facedet/retinaface/ort.rs +++ b/src/facedet/retinaface/ort.rs @@ -119,10 +119,10 @@ impl FaceDetectionBuilder { } impl FaceDetection { - pub fn builder>() - -> fn(T) -> std::result::Result> - { - FaceDetectionBuilder::new + pub fn builder>( + model: T, + ) -> std::result::Result> { + FaceDetectionBuilder::new(model) } pub fn new(path: impl AsRef) -> crate::errors::Result { @@ -134,7 +134,7 @@ impl FaceDetection { pub fn new_from_bytes(model: &[u8]) -> crate::errors::Result { tracing::info!("Loading ORT RetinaFace model from bytes"); - Self::builder()(model)?.build() + Self::builder(model)?.build() } } diff --git a/src/main.rs b/src/main.rs index 4b15bec..892e135 100644 --- a/src/main.rs +++ b/src/main.rs @@ -28,7 +28,7 @@ pub fn main() -> Result<()> { match executor { cli::Executor::Mnn => { let retinaface = - facedet::retinaface::mnn::FaceDetection::builder()(RETINAFACE_MODEL_MNN) + facedet::retinaface::mnn::FaceDetection::builder(RETINAFACE_MODEL_MNN) .change_context(Error)? .with_forward_type(detect.forward_type) .build() @@ -45,7 +45,7 @@ pub fn main() -> Result<()> { } cli::Executor::Onnx => { let retinaface = - facedet::retinaface::ort::FaceDetection::builder()(RETINAFACE_MODEL_ONNX) + facedet::retinaface::ort::FaceDetection::builder(RETINAFACE_MODEL_ONNX) .change_context(Error)? .build() .change_context(errors::Error)