feat: Added facenet

This commit is contained in:
uttarayan21
2025-08-07 17:24:01 +05:30
parent e60921b099
commit a3ea01b7b6
5 changed files with 14 additions and 9 deletions

View File

@@ -274,7 +274,7 @@ impl FaceDetection {
pub fn detect_faces(
&self,
image: ndarray::Array3<u8>,
image: ndarray::ArrayView3<u8>,
config: FaceDetectionConfig,
) -> Result<FaceDetectionOutput> {
let (height, width, _channels) = image.dim();
@@ -299,7 +299,8 @@ impl FaceDetection {
.map(|((b, s), l)| (b, s, l))
.multiunzip();
let keep_indices = nms(&boxes, &scores, config.threshold, config.nms_threshold);
let keep_indices =
nms(&boxes, &scores, config.threshold, config.nms_threshold).change_context(Error)?;
let bboxes = boxes
.into_iter()
@@ -327,7 +328,7 @@ impl FaceDetection {
})
}
pub fn run_models(&self, image: ndarray::Array3<u8>) -> Result<FaceDetectionModelOutput> {
pub fn run_models(&self, image: ndarray::ArrayView3<u8>) -> Result<FaceDetectionModelOutput> {
#[rustfmt::skip]
use ::tap::*;
let output = self

View File

@@ -1,5 +1,5 @@
use crate::errors::*;
use ndarray::{Array1, ArrayView3};
use ndarray::{Array1, Array2, ArrayView3, ArrayView4};
use std::path::Path;
#[derive(Debug)]
@@ -36,4 +36,8 @@ impl EmbeddingGenerator {
pub fn embedding(&self, roi: ArrayView3<u8>) -> Result<Array1<u8>> {
todo!()
}
pub fn embeddings(&self, roi: ArrayView4<u8>) -> Result<Array2<u8>> {
todo!()
}
}