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

8
flake.lock generated
View File

@@ -109,16 +109,16 @@
"mnn-src": {
"flake": false,
"locked": {
"lastModified": 1749173738,
"narHash": "sha256-pNljvQ4xMZ4VmuxQyXt+boNBZD0+UZNpNLrWrj8Rtfw=",
"lastModified": 1753256753,
"narHash": "sha256-aTpwVZBkpQiwOVVXDfQIVEx9CswNiPbvNftw8KsoW+Q=",
"owner": "alibaba",
"repo": "MNN",
"rev": "ebdada82634300956e08bd4056ecfeb1e4f23b32",
"rev": "a739ea5870a4a45680f0e36ba9662ca39f2f4eec",
"type": "github"
},
"original": {
"owner": "alibaba",
"ref": "3.2.0",
"ref": "3.2.2",
"repo": "MNN",
"type": "github"
}

View File

@@ -22,7 +22,7 @@
inputs.nixpkgs.follows = "nixpkgs";
};
mnn-src = {
url = "github:alibaba/MNN/3.2.0";
url = "github:alibaba/MNN/3.2.2";
flake = false;
};
};

Binary file not shown.

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!()
}
}