feat: Added facenet
This commit is contained in:
8
flake.lock
generated
8
flake.lock
generated
@@ -109,16 +109,16 @@
|
|||||||
"mnn-src": {
|
"mnn-src": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1749173738,
|
"lastModified": 1753256753,
|
||||||
"narHash": "sha256-pNljvQ4xMZ4VmuxQyXt+boNBZD0+UZNpNLrWrj8Rtfw=",
|
"narHash": "sha256-aTpwVZBkpQiwOVVXDfQIVEx9CswNiPbvNftw8KsoW+Q=",
|
||||||
"owner": "alibaba",
|
"owner": "alibaba",
|
||||||
"repo": "MNN",
|
"repo": "MNN",
|
||||||
"rev": "ebdada82634300956e08bd4056ecfeb1e4f23b32",
|
"rev": "a739ea5870a4a45680f0e36ba9662ca39f2f4eec",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
"owner": "alibaba",
|
"owner": "alibaba",
|
||||||
"ref": "3.2.0",
|
"ref": "3.2.2",
|
||||||
"repo": "MNN",
|
"repo": "MNN",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,7 @@
|
|||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
};
|
};
|
||||||
mnn-src = {
|
mnn-src = {
|
||||||
url = "github:alibaba/MNN/3.2.0";
|
url = "github:alibaba/MNN/3.2.2";
|
||||||
flake = false;
|
flake = false;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
Binary file not shown.
@@ -274,7 +274,7 @@ impl FaceDetection {
|
|||||||
|
|
||||||
pub fn detect_faces(
|
pub fn detect_faces(
|
||||||
&self,
|
&self,
|
||||||
image: ndarray::Array3<u8>,
|
image: ndarray::ArrayView3<u8>,
|
||||||
config: FaceDetectionConfig,
|
config: FaceDetectionConfig,
|
||||||
) -> Result<FaceDetectionOutput> {
|
) -> Result<FaceDetectionOutput> {
|
||||||
let (height, width, _channels) = image.dim();
|
let (height, width, _channels) = image.dim();
|
||||||
@@ -299,7 +299,8 @@ impl FaceDetection {
|
|||||||
.map(|((b, s), l)| (b, s, l))
|
.map(|((b, s), l)| (b, s, l))
|
||||||
.multiunzip();
|
.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
|
let bboxes = boxes
|
||||||
.into_iter()
|
.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]
|
#[rustfmt::skip]
|
||||||
use ::tap::*;
|
use ::tap::*;
|
||||||
let output = self
|
let output = self
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
use crate::errors::*;
|
use crate::errors::*;
|
||||||
use ndarray::{Array1, ArrayView3};
|
use ndarray::{Array1, Array2, ArrayView3, ArrayView4};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
#[derive(Debug)]
|
#[derive(Debug)]
|
||||||
@@ -36,4 +36,8 @@ impl EmbeddingGenerator {
|
|||||||
pub fn embedding(&self, roi: ArrayView3<u8>) -> Result<Array1<u8>> {
|
pub fn embedding(&self, roi: ArrayView3<u8>) -> Result<Array1<u8>> {
|
||||||
todo!()
|
todo!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn embeddings(&self, roi: ArrayView4<u8>) -> Result<Array2<u8>> {
|
||||||
|
todo!()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user