feat: Changed the struct for retinaface
This commit is contained in:
39
src/main.rs
39
src/main.rs
@@ -7,8 +7,10 @@ use fast_image_resize::ResizeOptions;
|
||||
use ndarray::*;
|
||||
use ndarray_image::*;
|
||||
use ndarray_resize::NdFir;
|
||||
const RETINAFACE_MODEL: &[u8] = include_bytes!("../models/retinaface.mnn");
|
||||
const FACENET_MODEL: &[u8] = include_bytes!("../models/facenet.mnn");
|
||||
const RETINAFACE_MODEL_MNN: &[u8] = include_bytes!("../models/retinaface.mnn");
|
||||
const FACENET_MODEL_MNN: &[u8] = include_bytes!("../models/facenet.mnn");
|
||||
const RETINAFACE_MODEL_ONNX: &[u8] = include_bytes!("../models/retinaface.onnx");
|
||||
const FACENET_MODEL_ONNX: &[u8] = include_bytes!("../models/facenet.onnx");
|
||||
const CHUNK_SIZE: usize = 8;
|
||||
pub fn main() -> Result<()> {
|
||||
tracing_subscriber::fmt()
|
||||
@@ -25,13 +27,14 @@ pub fn main() -> Result<()> {
|
||||
|
||||
match executor {
|
||||
cli::Executor::Mnn => {
|
||||
let retinaface = facedet::mnn::FaceDetection::builder()(RETINAFACE_MODEL)
|
||||
.change_context(Error)?
|
||||
.with_forward_type(detect.forward_type)
|
||||
.build()
|
||||
.change_context(errors::Error)
|
||||
.attach_printable("Failed to create face detection model")?;
|
||||
let facenet = faceembed::mnn::EmbeddingGenerator::builder()(FACENET_MODEL)
|
||||
let retinaface =
|
||||
facedet::retinaface::mnn::FaceDetection::builder()(RETINAFACE_MODEL_MNN)
|
||||
.change_context(Error)?
|
||||
.with_forward_type(detect.forward_type)
|
||||
.build()
|
||||
.change_context(errors::Error)
|
||||
.attach_printable("Failed to create face detection model")?;
|
||||
let facenet = faceembed::mnn::EmbeddingGenerator::builder()(FACENET_MODEL_MNN)
|
||||
.change_context(Error)?
|
||||
.with_forward_type(detect.forward_type)
|
||||
.build()
|
||||
@@ -41,17 +44,13 @@ pub fn main() -> Result<()> {
|
||||
run_detection(detect, retinaface, facenet)?;
|
||||
}
|
||||
cli::Executor::Onnx => {
|
||||
// Load ONNX models
|
||||
const RETINAFACE_ONNX_MODEL: &[u8] =
|
||||
include_bytes!("../models/retinaface.onnx");
|
||||
const FACENET_ONNX_MODEL: &[u8] = include_bytes!("../models/facenet.onnx");
|
||||
|
||||
let retinaface = facedet::ort::FaceDetection::builder()(RETINAFACE_ONNX_MODEL)
|
||||
.change_context(Error)?
|
||||
.build()
|
||||
.change_context(errors::Error)
|
||||
.attach_printable("Failed to create face detection model")?;
|
||||
let facenet = faceembed::ort::EmbeddingGenerator::builder()(FACENET_ONNX_MODEL)
|
||||
let retinaface =
|
||||
facedet::retinaface::ort::FaceDetection::builder()(RETINAFACE_MODEL_ONNX)
|
||||
.change_context(Error)?
|
||||
.build()
|
||||
.change_context(errors::Error)
|
||||
.attach_printable("Failed to create face detection model")?;
|
||||
let facenet = faceembed::ort::EmbeddingGenerator::builder()(FACENET_MODEL_ONNX)
|
||||
.change_context(Error)?
|
||||
.build()
|
||||
.change_context(errors::Error)
|
||||
|
||||
Reference in New Issue
Block a user