feat: Initial commit

This commit is contained in:
uttarayan21
2025-07-14 16:22:26 +05:30
commit 1d91e20db5
25 changed files with 5635 additions and 0 deletions

37
src/main.rs Normal file
View File

@@ -0,0 +1,37 @@
mod cli;
mod errors;
use errors::*;
use ndarray_image::*;
const RETINAFACE_MODEL: &[u8] = include_bytes!("../models/retinaface.mnn");
pub fn main() -> Result<()> {
tracing_subscriber::fmt()
.with_env_filter("trace")
.with_thread_ids(true)
.with_thread_names(true)
.with_target(false)
.init();
let args = <cli::Cli as clap::Parser>::parse();
match args.cmd {
cli::SubCommand::Detect(detect) => {
use detector::facedet;
let model = facedet::FaceDetection::new_from_bytes(RETINAFACE_MODEL)
.change_context(errors::Error)
.attach_printable("Failed to create face detection model")?;
let image = image::open(detect.image).change_context(Error)?;
let image = image.into_rgb8();
let array = image.into_ndarray()
.change_context(errors::Error)
.attach_printable("Failed to convert image to ndarray")?;
model.detect_faces(array)
.change_context(errors::Error)
.attach_printable("Failed to detect faces")?;
}
cli::SubCommand::List(list) => {
println!("List: {:?}", list);
}
cli::SubCommand::Completions { shell } => {
cli::Cli::completions(shell);
}
}
Ok(())
}