refactor(gui): remove commented-out code in face detection function
Some checks failed
build / checks-matrix (push) Successful in 19m20s
build / codecov (push) Failing after 19m18s
docs / docs (push) Has been cancelled
build / checks-build (push) Has been cancelled

This commit is contained in:
uttarayan21
2025-08-22 18:15:55 +05:30
parent dab7719206
commit 34eaf9348a

View File

@@ -181,27 +181,6 @@ impl FaceDetectionBridge {
nms_threshold: f32, nms_threshold: f32,
executor_type: ExecutorType, executor_type: ExecutorType,
) -> Result<(usize, usize, f32), Box<dyn std::error::Error + Send + Sync>> { ) -> Result<(usize, usize, f32), Box<dyn std::error::Error + Send + Sync>> {
// Load both images
// let img1 = image::open(&image1_path)?.to_rgb8();
// let img2 = image::open(&image2_path)?.to_rgb8();
// Convert to ndarray format
// let image1_array = img1.as_ndarray()?;
// let image2_array = img2.as_ndarray()?;
// Create detection configuration
let config1 = FaceDetectionConfig::default()
.with_threshold(threshold)
.with_nms_threshold(nms_threshold)
.with_input_width(1024)
.with_input_height(1024);
let config2 = FaceDetectionConfig::default()
.with_threshold(threshold)
.with_nms_threshold(nms_threshold)
.with_input_width(1024)
.with_input_height(1024);
// Create detector and embedder, detect faces and generate embeddings // Create detector and embedder, detect faces and generate embeddings
let (faces1, faces2, best_similarity) = match executor_type { let (faces1, faces2, best_similarity) = match executor_type {
ExecutorType::MnnCpu | ExecutorType::MnnMetal | ExecutorType::MnnCoreML => { ExecutorType::MnnCpu | ExecutorType::MnnMetal | ExecutorType::MnnCoreML => {
@@ -303,7 +282,6 @@ where
.change_context(Error) .change_context(Error)
.attach_printable(image.to_string_lossy().to_string())?; .attach_printable(image.to_string_lossy().to_string())?;
let image = image.into_rgb8(); let image = image.into_rgb8();
// let (image_width, image_height) = image.dimensions();
let mut array = image let mut array = image
.into_ndarray() .into_ndarray()
.change_context(errors::Error) .change_context(errors::Error)
@@ -317,7 +295,6 @@ where
) )
.change_context(errors::Error) .change_context(errors::Error)
.attach_printable("Failed to detect faces")?; .attach_printable("Failed to detect faces")?;
dbg!(&output);
for bbox in &output.bbox { for bbox in &output.bbox {
tracing::info!("Detected face: {:?}", bbox); tracing::info!("Detected face: {:?}", bbox);